Skip to content

Instantly share code, notes, and snippets.

@chef
Created May 15, 2009 00:01
Show Gist options
  • Save chef/111992 to your computer and use it in GitHub Desktop.
Save chef/111992 to your computer and use it in GitHub Desktop.
Feature: List roles via the REST API
In order to know what roles exists programatically
As a Developer
I want to list all the roles
Scenario: List roles when none have been created # ./features/roles/list_roles_api.feature:6
Given a 'registration' named 'bobo' exists # features/steps/fixture_steps.rb:51
And there are no roles # features/steps/fixture_steps.rb:73
When I authenticate as 'bobo' # features/steps/request_steps.rb:19
And I 'GET' the path '/roles' # features/steps/request_steps.rb:1
Then the inflated response should be an empty array # features/steps/response_steps.rb:21
Scenario: List roles when one has been created # ./features/roles/list_roles_api.feature:13
Given a 'registration' named 'bobo' exists # features/steps/fixture_steps.rb:51
Given a 'role' named 'webserver' exists # features/steps/fixture_steps.rb:51
When I authenticate as 'bobo' # features/steps/request_steps.rb:19
And I 'GET' the path '/roles' # features/steps/request_steps.rb:1
Then the inflated response should include '^http://.+/roles/webserver$' # features/steps/response_steps.rb:25
Scenario: List roles when two have been created # ./features/roles/list_roles_api.feature:20
Given a 'registration' named 'bobo' exists # features/steps/fixture_steps.rb:51
And a 'role' named 'webserver' exists # features/steps/fixture_steps.rb:51
And a 'role' named 'db' exists # features/steps/fixture_steps.rb:51
When I authenticate as 'bobo' # features/steps/request_steps.rb:19
And I 'GET' the path '/roles' # features/steps/request_steps.rb:1
Then the inflated response should be '2' items long # features/steps/response_steps.rb:29
And the inflated response should include '^http://.+/roles/webserver$' # features/steps/response_steps.rb:25
And the inflated response should include '^http://.+/roles/db$' # features/steps/response_steps.rb:25
Scenario: List roles when you are not authenticated # ./features/roles/list_roles_api.feature:30
When I 'GET' the path '/roles' # features/steps/request_steps.rb:1
Then I should get a '401 "Unauthorized"' exception # features/steps/response_steps.rb:1
4 scenarios
20 passed steps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment