Here's a preview of what I'm working on. The intention is that when you run
script/generate hobo_model_resource widget name:string Then a feature file like the ones below gets automatically generated, reflecting the default Hobo behaviour. Then when you begin to customise the behaviour, you just edit the scenarios as appropriate. Andy # crea# create Scenario: Create widget Given I am allowed to create a new widget And I am on the new widget page When I fill in "widget[name]" with "Bob" And I press "Create Widget" Then I should see "The widget was created successfully" When I go to the edit widget page for "Bob" Then the field named "widget[name]" should contain "Bob" Scenario: Should go to show page after creation Given I am creating a new widget And I fill in "widget[name]" with "Bob" When I press "Create" Then I should be on the show widget page for "Bob" Scenario: Administrators should be able to access the new widget form Given I am logged in as "Andy" And "Andy" is an administrator And I am on the widget index page When I follow "New Widget" Then I should see a new widget form Scenario: Non-administrators should not see a New Widget link Given I am logged in as "Andy" And "Andy" is not an administrator When I follow "Widgets" Then I should not see "New Widget" Scenario: Non-administrators should not be able to access the new widget form Given I am logged in as "Andy" And "Andy" is not an administrator When I go to the new widget page Then I should not see a new widget form Scenario: Cancel button on new page should go to home page Given I am allowed to create a new widget And I am on the new widget page When I follow "Cancel" Then I should be on the homepage # read Scenario: Display the number of widgets Given I am allowed to view widgets And there are 0 widgets When I go to the widget index page Then I should see "No widgets to display" Given there is a widget named "Joe" When I go to the widget index page Then I should see "There is 1 Widget" Given there is a widget named "Bob" When I go to the widget index page Then I should see "There are 2 Widgets" Scenario: Guests should be able to view a list of widgets Given I am not logged in And there is a widget named "Joe" And I am on the homepage When I follow "Widgets" Then I should see "There is 1 Widget" And I should see a card for "Joe" When I follow "Joe" Then I should be on the show widget page for "Joe" Scenario: Should have page navigation at top and bottom Given there are 35 widgets When I go to the widgets index page Then I should see bottom page navigation And I should see top page navigation Scenario: Navigation using prev/next Given there are 35 widgets When I go to the widgets index page Then I should see bottom page navigation And I should see 30 widgets When I follow "Next »" Then I should see 5 widgets When I follow "« Prev" Then I should see 30 widgets Scenario: Navigation should be hidden when 30 or less widgets per page Given there are 30 widgets When I go to the widgets index page Then I should see 30 widgets And I should not see page navigation Scenario: There should be 30 widgets per page Given there are 35 widgets When I go to the widgets index page Then I should see 30 widgets When I follow "2" Then I should see 5 widgets Scenario: Navigation for large number of items Pending Scenario: Navigation by page number Pending # update Scenario: Cancel button on edit page should go to show page Given I am editing the widget named "Bob" When I follow "Cancel" Then I should be on the show widget page for "Bob" Scenario: Admin users should see an edit widget link Given there is a widget named "Bob" And I am logged in as "Andy" And "Andy" is an administrator When I follow "Widgets" And I follow "Bob" Then I should see "Edit Widget" Scenario: Admin users should be have access to the edit widget form Given there is a widget named "Bob" And I am logged in as "Andy" And "Andy" is an administrator When I go to the edit widget page for "Bob" Then I should see an edit widget form Scenario: Edit Widget Given there is a widget named "Bob" And I am allowed to edit the widget named "Bob" When I go to the edit widget page for "Bob" Then the field named "widget[name]" should contain "Bob" When I fill in "widget[name]" with "Bob Changed" And I press "Save" Then I should see "Changes to the widget were saved" And I should be on the show widget page for "Bob Changed" When I follow "Edit Widget" Then the field named "widget[name]" should contain "Bob Changed" Scenario: Non-admin users should not be able to edit widgets Given there is a widget named "Bob" And I am not logged in When I follow "Widgets" Then I should see a card for "Bob" When I follow "Bob" Then I should not see "Edit Widget" # delete Scenario: Delete widget Given there is a widget named "Bob" And I am allowed to edit the widget named "Bob" When I go to the edit widget page for "Bob" And I press "Remove This Widget" Then I should see "The widget was deleted" And I should be on the widget index page And I should not see "Bob" Scenario: Admin users should be able to remove widgets using the edit page Given there is a widget named "Bob" And I am logged in as "Andy" And "Andy" is an administrator When I follow "Widgets" And I can see "Bob" And I follow "Bob" Then I should see "Edit Widget" # The following are examples of how your test validates_uniqueness_of and # validates_presence_of - comment them in/out as appropriate for your model Scenario: Name should be unique Given there is a widget named "Bob" And I am creating a new widget And I fill in "widget[name]" with "Bob" When I press "Create" Then I should see "Name has already been taken" When I fill in "widget[name]" with "Bob 2" And I press "Create" Then I should not see "Name already exists" Scenario: Name should be mandatory Given I am creating a new widget And I fill in "widget[name]" with "" When I press "Create" Then I should see "Name can't be blank" When I fill in "widget[name]" with "Bob" And I press "Create" Then I should see "The widget was created successfully" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
