spec/druid/page_factory_spec.rb in druid-ts-1.1.2 vs spec/druid/page_factory_spec.rb in druid-ts-1.1.3

- old
+ new

@@ -4,10 +4,15 @@ class FactoryTestDruid include Druid page_url "http://google.com" end +class TestPageWithDirectUrl + include Druid + direct_url "http://google.com" +end + class AnotherPage include Druid end class YetAnotherPage @@ -35,13 +40,34 @@ world.on_page FactoryTestDruid do |page| expect(page).to be_instance_of FactoryTestDruid end end + it "should create a new page object and execute a block using 'on'" do + expect(driver).not_to receive(:goto) + world.on FactoryTestDruid do |page| + expect(page).to be_instance_of FactoryTestDruid + end + end + it "should create and visit a new page" do expect(driver).to receive(:goto) world.visit_page FactoryTestDruid do |page| expect(page).to be_instance_of FactoryTestDruid + end + end + + it "should create and visit a new page using 'visit'" do + expect(driver).to receive(:goto) + world.visit FactoryTestDruid do |page| + expect(page).to be_instance_of FactoryTestDruid + end + end + + it "should create and visit a new page when url is defined as 'direct_url'" do + expect(driver).to receive(:goto) + world.visit TestPageWithDirectUrl do |page| + expect(page).to be_instance_of TestPageWithDirectUrl end end it "should set an instance variable that can be used outside of the block" do expect(driver).not_to receive(:goto)