2009-07-14

Generic Cucumber Steps

Zwei generische Steps, die das Ergebnis erster Gehversuche mit Cucumber sind. (Factory = factory_girl)


# Match steps like:
# * And I have projects named A, B, C
Given /^I have .+ named (.+)$/ do |names|
names.split(', ').each do |name|
Factory.create(name)
end
end

# Match steps like:
# * And I should have 1 project
# * And I should have 5 users
Then /^I should have ([0-9]+) (.+)$/ do |count, classes|
Kernel.const_get(classes.singularize.capitalize).count.should == count.to_i
end

Keine Kommentare

Kommentar veröffentlichen