Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / example_rails_app / stories / add_person.rb
blob64931cb0c821ad6af208ffa55da745e8dc612d5b
1 require File.join(File.dirname(__FILE__), "helper")
3 Story "Add Person", %{
4   As an admin
5   I want to add people to the system
6   So that I show how many people use my system
7 }, :type => RailsStory do
8   Scenario "Successfully add person" do
9     Given "no people in the system" do
10       Person.destroy_all
11     end
12     
13     When "creating a new person named", "Dan" do |name|
14       post "people/create", :person => {:name => name}
15     end
16     
17     Then "viewer should see", "people/list" do |template|
18       follow_redirect!
19       response.should render_template(template)
20     end
21     
22     Then "list should include", "Dan" do |name|
23       response.should have_text(/#{name}/)
24     end
25   end
26   
27   Scenario "Redirect to create form on failed create" do
28     Given "no people in the system" do
29       Person.destroy_all
30     end
31     
32     When "creating a new person with no name" do
33 #      post "/people/create", :person => {:name => nil}
34       When "creating a new person named", nil
35     end
36     
37     Then "viewer should see", "people/create" do |template|
38       assert_template template
39     end
40     
41     Then "list should not include", "Dan" do |name|
42       response.should_not have_text(/#{name}/)
43     end
44   end
45   
46   Scenario "This is supposed to come up as pending."
47 end