spec/page_spec.rb in taza-0.8.7 vs spec/page_spec.rb in taza-0.9.0

- old
+ new

@@ -1,10 +1,10 @@ -require 'spec/spec_helper' +require 'spec_helper' require 'taza/page' describe Taza::Page do - + class ElementAndFilterContextExample < Taza::Page element(:sample_element) {browser} filter:sample_filter, :sample_element def sample_filter browser @@ -27,21 +27,21 @@ it "should execute an element's block with the params provided for its method" do Taza::Page.element(:boo){|baz| baz} Taza::Page.new.boo("rofl").should == "rofl" end - + it "should execute elements and filters in the context of the page instance" do page = ElementAndFilterContextExample.new page.browser = :something page.sample_element.should eql(:something) end - + it "should add a filter to the classes filters" do - ElementAndFilterContextExample.filters.size.should eql(1) + ElementAndFilterContextExample.filters.size.should eql(1) end - + it "should store the block given to the element method in a method with the name of the parameter" do Taza::Page.element(:foo) do "bar" end Taza::Page.new.foo.should == "bar" @@ -54,16 +54,16 @@ def false_filter false end end - + it "should filter all elements if element argument is not provided" do lambda { FilterAllElements.new.apple }.should raise_error(Taza::FilterError) lambda { FilterAllElements.new.foo }.should raise_error(Taza::FilterError) end - + it "should have empty elements on a new class" do foo = Class::new(superclass=Taza::Page) foo.elements.should_not be_nil foo.elements.should be_empty end @@ -85,10 +85,10 @@ end it "should raise a error if an elements is called and its filter returns false" do lambda { FilterAnElement.new.false_item }.should raise_error(Taza::FilterError) end - + it "should not call element block if filters fail" do page = FilterAnElement.new lambda { page.false_item }.should raise_error page.called_element_method.should_not be_true end