factor out field check into expect_field

This commit is contained in:
John Bintz 2012-10-01 11:54:12 -04:00
parent be072f5ff1
commit 5c82163943
1 changed files with 4 additions and 1 deletions

View File

@ -24,7 +24,7 @@ def expect_fields(object, *fields, &block)
within finder do within finder do
fields.flatten.each do |field| fields.flatten.each do |field|
find(".#{field}").text.should == object.send(field).to_s expect_field field, object.send(field).to_s
end end
block.call(object) if block block.call(object) if block
@ -35,3 +35,6 @@ def expect_fields(object, *fields, &block)
@__expect_stack = nil if @__expect_stack == 0 @__expect_stack = nil if @__expect_stack == 0
end end
def expect_field(field, value)
find(".#{field}").text.should == value
end