Skip to content

Commit

Permalink
test corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
leonovk committed Nov 3, 2023
1 parent 5b3c4b6 commit 8fa9865
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 4 additions & 8 deletions test/lib/boaw_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,17 @@ def test_position
end

def test_left_click
position = @position
@mock_adapter.expect(:left_click, nil, [@position])

@mock_adapter.expect(:left_click, nil, [position])

@boaw.left_click(position)
@boaw.left_click(@position)

@mock_adapter.verify
end

def test_right_click
position = @position

@mock_adapter.expect(:right_click, nil, [position])
@mock_adapter.expect(:right_click, nil, [@position])

@boaw.right_click(position)
@boaw.right_click(@position)

@mock_adapter.verify
end
Expand Down
8 changes: 6 additions & 2 deletions test/lib/xdotool/adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ def setup
def test_left_click
mock_kernel = Minitest::Mock.new
mock_kernel.expect(:system, nil, ['xdotool mousemove 1 2 click 1'])
Kernel.stub :system, ->(a) { mock_kernel.system(a) } do

Kernel.stub :system, ->(position) { mock_kernel.system(position) } do
@adapter.left_click(@position)
end

mock_kernel.verify
end

def test_right_click
mock_kernel = Minitest::Mock.new
mock_kernel.expect(:system, nil, ['xdotool mousemove 1 2 click 3'])
Kernel.stub :system, ->(a) { mock_kernel.system(a) } do

Kernel.stub :system, ->(position) { mock_kernel.system(position) } do
@adapter.right_click(@position)
end

mock_kernel.verify
end
end
Expand Down

0 comments on commit 8fa9865

Please sign in to comment.