diff --git a/lib/ae_page_objects/node.rb b/lib/ae_page_objects/node.rb index b1acc049..661dbbce 100644 --- a/lib/ae_page_objects/node.rb +++ b/lib/ae_page_objects/node.rb @@ -54,8 +54,6 @@ def current_url_without_params class_eval <<-RUBY def #{m}(*args, &block) node.send(:#{m}, *args, &block) - rescue Capybara::ElementNotFound => e - raise LoadingElementFailed, e.message end RUBY end @@ -89,7 +87,7 @@ def loaded_locator def ensure_loaded! if locator = loaded_locator - find(*eval_locator(locator)) + node.find(*eval_locator(locator)) end self diff --git a/test/test_helpers/node_interface_tests.rb b/test/test_helpers/node_interface_tests.rb index e8c1ba85..c7a48c20 100644 --- a/test/test_helpers/node_interface_tests.rb +++ b/test/test_helpers/node_interface_tests.rb @@ -10,7 +10,7 @@ def test_node_method_wraps_not_found error = Capybara::ElementNotFound.new("The message") capybara_stub.session.expects(method).with(:args).raises(error) - raised = assert_raises AePageObjects::LoadingElementFailed do + raised = assert_raises error do subject.send(method, :args) end diff --git a/test/unit/document_test.rb b/test/unit/document_test.rb index da300ee5..72b90bbb 100644 --- a/test/unit/document_test.rb +++ b/test/unit/document_test.rb @@ -64,14 +64,14 @@ def loaded_locator end some_document_class.expects(:can_load_from_current_url?).returns(true) - element_error = LoadingElementFailed.new("Twas an error") - some_document_class.any_instance.expects(:find).with("#hello").raises(element_error) + capybara_error = Capybara::ElementNotFound.new("Twas an error") + capybara_stub.session.expects(:find).with("#hello").raises(capybara_error) raised = assert_raises LoadingPageFailed do some_document_class.new end - assert_equal element_error.message, raised.message + assert_equal capybara_error.message, raised.message end def test_stale