spec/lib/mohawk/navigation_spec.rb in mohawk-0.4.2 vs spec/lib/mohawk/navigation_spec.rb in mohawk-0.4.3
- old
+ new
@@ -1,7 +1,16 @@
require 'spec_helper'
+def non_existent_locator
+ {:title => /I don't exist/}
+end
+
+class NonExistentScreen
+ include Mohawk
+ window non_existent_locator
+end
+
describe Mohawk::Navigation do
context '#on with extra info' do
When { start_app }
Then { on(MainForm, pid: Mohawk.app.pid).present? }
end
@@ -20,6 +29,14 @@
end
When(:data_entry_form) { navigate_to(DataEntryForm) }
Then { expect(data_entry_form).to be_present }
end
-end
\ No newline at end of file
+
+ context 'name the screen that could not be found' do
+ When { Mohawk.timeout = 1 }
+ Then do
+ screen_class = NonExistentScreen
+ expect { on(screen_class) }.to raise_error Mohawk::Waiter::WaitTimeout, "Unable to locate #{screen_class} using #{non_existent_locator}"
+ end
+ end
+end