[rspec-devel] [ rspec-Feature Requests-13554 ] Add & amp; quot; And& amp; quot; so you can say Given... And... When... Then... And...

noreply at rubyforge.org noreply at rubyforge.org
Sat Sep 1 19:11:48 EDT 2007


Feature Requests item #13554, was opened at 2007-08-31 14:12
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=13554&group_id=797

Category: Story Runner
Group: None
>Status: Closed
Priority: 3
Submitted By: Dan North (tastapod)
Assigned to: Dan North (tastapod)
>Summary: Add "And" so you can say Given... And... When... Then... And...

Initial Comment:
When you write a scenario, the natural English is:

Given something
And something else
When this happens
And this happens
Then this should be true
And so should this

There should be an And() method in World that supports this construct.

----------------------------------------------------------------------

>Comment By: Dan North (tastapod)
Date: 2007-09-02 00:11

Message:
Updated PlainTextDocumenter to print And for multiple givens, events and outcomes. Committed as r2489.

The decision has to be in the documenter because a step may be used as the first Given in one scenario, and as an additional Given (and therefore documented as "And") in another.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-31 15:50

Message:
No apologies, please. It's too early for that :)

----------------------------------------------------------------------

Comment By: Dan North (tastapod)
Date: 2007-08-31 15:49

Message:
Whoops. Didn't think of that! Also, apologies for not putting a revision number with the previous comment.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-31 15:31

Message:
Reopening this - 

I've got this:

Given "user is already registered as", "foo", "test" do |login, password|
  @user = User.create!(:login => login, :password => password, :password_confirmation => password, :email => 'a at b.com')
  @user.activate
  @user.save!
end
When "user logs in with", "foo", "test", :follow_redirect => true do |login, password, opts|
  post "/sessions", :login => login, :password => password
  follow_redirect! if opts[:follow_redirect]
end
Then "user should see", 'polls/index' do |template_path|
  response.should render_template(template_path)
end
And "user should see link to", "My Profile" do |link|
  response.should have_tag("a", link)
end
....

but it gets reported like this:

  Given user is already registered as foo,test
  When user logs in with foo,test,follow_redirecttrue
  Then user should see polls/index
  Then user should see link to My Profile
  
  
That second Then is an And in the code and should reported as such, no?


----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-31 15:27

Message:
Hey Dan - we're in the habit of noting the revision number when a ticket gets closed.

Done. r2483

----------------------------------------------------------------------

Comment By: Dan North (tastapod)
Date: 2007-08-31 14:18

Message:
Done.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=13554&group_id=797


More information about the rspec-devel mailing list