Skip to content

Commit

Permalink
Test rspec helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline committed Jun 20, 2015
1 parent 7075fc0 commit b4c4ad4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/angular_webdriver/protractor/protractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ def initialize opts={}
#
# toplevel self enables by/element from within pry. rspec helpers enables
# by/element within rspec tests when used with install_rspec_helpers.
toplevel_main = eval('self', TOPLEVEL_BINDING)
[toplevel_main, AngularWebdriver::RSpecHelpers].each do |obj|
toplevel_main = TOPLEVEL_BINDING.eval('self')
[toplevel_main, ::AngularWebdriver::RSpecHelpers].each do |obj|
method_type = :define_singleton_method

obj.send method_type, :element do |*args|
Expand Down
8 changes: 7 additions & 1 deletion spec/protractor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
expect_no_error { driver.get protractor.reset_url }

# protractor.get should raise error on invalid destination
expect_argument_error { protractor.get({ invalid: 'object '}) }
expect_argument_error { protractor.get({ invalid: 'object ' }) }
end

it 'driver_get' do
Expand Down Expand Up @@ -389,4 +389,10 @@ def async_two_arg
no_wait { expect_no_error { driver.get 'localhost:8081' } }
no_wait { expect_no_error { driver.get 'http://localhost:8081' } }
end

it 'populates rspec helpers module' do
actual = AngularWebdriver::RSpecHelpers.singleton_methods.sort
expected = %i(by element no_wait)
expect_equal actual, expected
end
end

0 comments on commit b4c4ad4

Please sign in to comment.