spec/site_spec.rb in taza-0.8.4 vs spec/site_spec.rb in taza-0.8.5

- old
+ new

@@ -1,8 +1,12 @@ require 'spec/spec_helper' require 'rubygems' -require 'taza' +require 'taza/site' +require 'taza/settings' +require 'taza/browser' +require 'taza/page' +require 'taza/flow' describe Taza::Site do before :all do @pages_path = File.join("spec","sandbox","pages","foo","**","*.rb") @@ -222,8 +226,27 @@ def stub_browser browser = stub() browser.stubs(:close) browser.stubs(:goto) browser + end + + it "should yield an instance of page class that can access page-module specific elements" do + f = Foo.new(:browser => stub_browser) + barzor = nil + f.baz(:module) do |baz| + barzor = baz + end + barzor.should be_an_instance_of(Baz) + barzor.some_element.should eql(:some_element_value) + end + + it "should raise an error when accessing an element taht belongs to another module" do + f = Foo.new(:browser => stub_browser) + barzor = nil + f.baz(:another_module) do |baz| + barzor = baz + end + lambda{barzor.other_element}.should raise_error(NoMethodError) end end