spec/cucumber/step_definition_spec.rb in kosmas58-cucumber-0.2.0.1 vs spec/cucumber/step_definition_spec.rb in kosmas58-cucumber-0.2.2.1
- old
+ new
@@ -56,26 +56,38 @@
lambda do
step_match("Outside").invoke(@world, nil)
end.should raise_error(Pending, "Do me!")
end
-
- it "should have a #to_s suitable for automcompletion" do
- stepdef = Given /Hello (.*)/ do
- end
-
- stepdef.to_s.should == '/Hello (.*)/ # spec/cucumber/step_definition_spec.rb:63'
- stepdef.to_s(2).should == '/Hello (.*)/ # spec/cucumber/step_definition_spec.rb:63'
- end
-
+
it "should allow announce" do
v = mock('visitor')
v.should_receive(:announce).with('wasup')
self.visitor = v
world = new_world!
Given /Loud/ do
announce 'wasup'
end
step_match("Loud").invoke(world, nil)
+ end
+
+ def unindented(s)
+ s.split("\n")[1..-2].join("\n").indent(-8)
+ end
+
+ it "should recognise quotes in name and make according regexp" do
+ StepDefinition.snippet_text('Given', 'A "first" arg').should == unindented(%{
+ Given /^A "([^\\"]*)" arg$/ do |arg1|
+ pending
+ end
+ })
+ end
+
+ it "should not use quote group when there are no quotes" do
+ StepDefinition.snippet_text('Given', 'A first arg').should == unindented(%{
+ Given /^A first arg$/ do
+ pending
+ end
+ })
end
end
end