Skip to content

Commit

Permalink
Fixes rubocop offenses. Closes rpossan#7 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronaldo Possan committed Nov 7, 2018
1 parent 63c637a commit f8b0eb2
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Rake::TestTask.new(:test) do |t|

desc 'Run Rubocop analysis and open in the browser'
task :rubocop do
system 'rubocop -f html -o rubocop.html & start chrome rubocop.html'
system "rubocop -f html -o rubocop.html -c rubocop.yml &\
start chrome rubocop.html"
end
end

Expand Down
9 changes: 4 additions & 5 deletions lib/autoit/control.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module AutoIt
# Class module to execute control commands on AutoIt DLL. Its possible
# to run native commands and some methods for object
class Control

attr_reader :win

def initialize
Expand Down Expand Up @@ -34,17 +33,17 @@ def click_on(title, id, text = nil)
def get_text(title)
win.WinGetText(title)
end
def has_text?(title, text, get_int=false)

def text?(title, text, get_int = false)
found = get_text title
found = text.to_i.to_s if get_int
found == text
end

private

def execute
yield > 0
end

end
end
end
2 changes: 1 addition & 1 deletion lib/autoit/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Autoit
VERSION = "0.2.0"
VERSION = '0.2.0'.freeze
end
3 changes: 3 additions & 0 deletions rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AllCops:
Exclude:
- '**/*.gemspec'
4 changes: 1 addition & 3 deletions test/autoit_test.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require "test_helper"
require 'test_helper'

class AutoitTest < Minitest::Test

def test_that_it_has_a_version_number
refute_nil ::Autoit::VERSION
end

end
35 changes: 17 additions & 18 deletions test/control_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "test_helper"
require "byebug"
require 'test_helper'
require 'byebug'

class ControlTest < Minitest::Test
i_suck_and_my_tests_are_order_dependent!
Expand All @@ -15,30 +15,29 @@ def test_control_is_contol
end

def test_open_app
assert @control.open_app("calc")
@control.win_close "Calculator"
assert @control.open_app('calc')
@control.win_close 'Calculator'
end

def test_not_open_app
refute @control.open_app("foo")
refute @control.open_app('foo')
end

def test_sum
@control.click_on("Calculator", "[ID:135]", "5")
@control.click_on("Calculator", "[ID:93]", "+")
@control.click_on("Calculator", "[ID:135]", "5")
@control.click_on("Calculator", "[ID:121]", "=")
assert @control.has_text?("Calculator", "10", true)
@control.win_close "Calculator"
@control.click_on('Calculator', '[ID:135]', '5')
@control.click_on('Calculator', '[ID:93]', '+')
@control.click_on('Calculator', '[ID:135]', '5')
@control.click_on('Calculator', '[ID:121]', '=')
assert @control.text?('Calculator', '10', true)
@control.win_close 'Calculator'
end

def test_command
args = ["Calculator", "8", "[ID:138]"]
@control.command("run", ["calc"])
@control.command("WinWaitActive", ["Calculator", nil, 30])
@control.command("ControlClick", args)
assert @control.has_text?("Calculator", "8", true)
@control.win_close "Calculator"
args = ['Calculator', '8', '[ID:138]']
@control.command('run', ['calc'])
@control.command('WinWaitActive', ['Calculator', nil, 30])
@control.command('ControlClick', args)
assert @control.text?('Calculator', '8', true)
@control.win_close 'Calculator'
end

end
6 changes: 3 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "autoit"
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'autoit'

require "minitest/autorun"
require 'minitest/autorun'

0 comments on commit f8b0eb2

Please sign in to comment.