spec/druid/page_factory_spec.rb in druid-ts-1.1.6 vs spec/druid/page_factory_spec.rb in druid-ts-1.1.7
- old
+ new
@@ -187,14 +187,23 @@
Druid::PageFactory.routes = {:default => routes}
expect(Druid::PageFactory.page_object_routes[:default]).to eql routes
end
it "should navigate to a page calling the default methods" do
- pages = [[FactoryTestDruid, :a_method], [AnotherPage,:b_method]]
+ pages = [[FactoryTestDruid, :a_method], [AnotherPage, :b_method]]
Druid::PageFactory.routes = {:default => pages}
fake_page = double('a_page')
expect(FactoryTestDruid).to receive(:new).with(driver,false).and_return(fake_page)
expect(fake_page).to receive(:a_method)
+ expect(world.navigate_to(AnotherPage).class).to eql AnotherPage
+ end
+
+ it "should pass parameters to methods when navigating" do
+ pages = [[FactoryTestDruid, :a_method, 'blah'], [AnotherPage, :b_method]]
+ Druid::PageFactory.routes = {:default => pages}
+ fake_page = double('a_page')
+ expect(FactoryTestDruid).to receive(:new).with(driver,false).and_return(fake_page)
+ expect(fake_page).to receive(:a_method).with('blah')
expect(world.navigate_to(AnotherPage).class).to eql AnotherPage
end
it "should fail when it does not find a proper route" do
Druid::PageFactory.routes = {:default => ['a'], :another => ['b']}