Skip to content

Instantly share code, notes, and snippets.

@jackcasey
Created February 14, 2012 08:34
Show Gist options
  • Save jackcasey/1824828 to your computer and use it in GitHub Desktop.
Save jackcasey/1824828 to your computer and use it in GitHub Desktop.
Some cucumber features
Feature: Trials api - Authentication
In order to display my information on the trials iPad app
As a Trial Assessor
I want to be able to authenticate with the web service
Background: # features/trialsapi_authentication.feature:6
Given there is a company # features/step_definitions/company_steps.rb:1
And there is a trial assessor # features/trialsapi_steps.rb:19
And I accept JSON # features/trialsapi_steps.rb:15
Scenario: I can authenticate to fetch my api key # features/trialsapi_authentication.feature:11
Given parameters include "email" as "assessor@example.com" # features/trialsapi_steps.rb:109
And parameters include "password" as "assessorpass" # features/trialsapi_steps.rb:109
And I fetch "/trials_api/getkey.json" with parameters # features/trialsapi_steps.rb:114
Then I should receive the api_key "ASSESSORKEY" # features/trialsapi_steps.rb:118
Scenario: If email is incorrect, don't authenticate # features/trialsapi_authentication.feature:18
Given parameters include "email" as "assessoink@example.com" # features/trialsapi_steps.rb:109
And parameters include "password" as "assessorpass" # features/trialsapi_steps.rb:109
And I fetch "/trials_api/getkey.json" with parameters # features/trialsapi_steps.rb:114
Then I should receive an unauthorized error # features/trialsapi_steps.rb:123
Scenario: If password is incorrect, don't authenticate # features/trialsapi_authentication.feature:25
Given parameters include "email" as "assessor@example.com" # features/trialsapi_steps.rb:109
And parameters include "password" as "assessorpasture" # features/trialsapi_steps.rb:109
And I fetch "/trials_api/getkey.json" with parameters # features/trialsapi_steps.rb:114
Then I should receive an unauthorized error # features/trialsapi_steps.rb:123
Feature: Trials api - Plots
In order to display my information on the trials iPad app
As a Trial Assessor
I want to be able to access the Plots api
Background: # features/trialsapi_plots_source.feature:6
Given there is a company # features/step_definitions/company_steps.rb:1
And there is a trial assessor # features/trialsapi_steps.rb:19
And I accept JSON # features/trialsapi_steps.rb:15
And there is a trial # features/trialsapi_steps.rb:29
And there is a plot named "A1" # features/trialsapi_steps.rb:74
And there is a plot named "A2" # features/trialsapi_steps.rb:74
And the trial refers to plot "A1" # features/trialsapi_steps.rb:78
And the trial refers to plot "A2" # features/trialsapi_steps.rb:78
Scenario: I can see plots refered to by my trials # features/trialsapi_plots_source.feature:16
Given I am accessing the API as assessor # features/trialsapi_steps.rb:25
And there is an assessment assigned to assessor named "TestThis!" # features/trialsapi_steps.rb:42
And I fetch "/trials_api/plots.json" # features/trialsapi_steps.rb:46
Then I should see a plot named "A1" # features/trialsapi_steps.rb:82
And I should see a plot named "A2" # features/trialsapi_steps.rb:82
And I should not see a plot named "Sausage" # features/trialsapi_steps.rb:87
Scenario: I can't see plots if I don't have an assessment # features/trialsapi_plots_source.feature:25
Given I am accessing the API as assessor # features/trialsapi_steps.rb:25
And I fetch "/trials_api/plots.json" # features/trialsapi_steps.rb:46
Then I should not see a plot named "A1" # features/trialsapi_steps.rb:87
And I should not see a plot named "A2" # features/trialsapi_steps.rb:87
Feature: Trials api - Traits
In order to display my information on the trials iPad app
As a Trial Assessor
I want to be able to access the Traits api
Background: # features/trialsapi_traits_source.feature:6
Given there is a company # features/step_definitions/company_steps.rb:1
And there is a trial assessor # features/trialsapi_steps.rb:19
And I accept JSON # features/trialsapi_steps.rb:15
Scenario: I can see traits refered to by my assessments # features/trialsapi_traits_source.feature:11
Given I am accessing the API as assessor # features/trialsapi_steps.rb:25
And there is a trial # features/trialsapi_steps.rb:29
And there is an assessment assigned to assessor named "TestThis!" # features/trialsapi_steps.rb:42
And there is a trait named "Color" # features/trialsapi_steps.rb:95
And there is a trait named "Vigor" with a label named "Strong" # features/trialsapi_steps.rb:99
And there is a trait named "Curvature" # features/trialsapi_steps.rb:95
And the assessment refers to trait "Color" # features/trialsapi_steps.rb:105
And the assessment refers to trait "Vigor" # features/trialsapi_steps.rb:105
And I fetch "/trials_api/traits.json" # features/trialsapi_steps.rb:46
Then I should see a trait named "Color" # features/trialsapi_steps.rb:82
And I should see a trait named "Vigor" # features/trialsapi_steps.rb:82
And it should have a label named "Strong" # features/trialsapi_steps.rb:91
And I should not see a trait named "Curvature" # features/trialsapi_steps.rb:87
Feature: Trials api - Trials
In order to display my information on the trials iPad app
As a Trial Assessor
I want to be able to access the Trials api
Background: # features/trialsapi_trials_source.feature:6
Given there is a company # features/step_definitions/company_steps.rb:1
And there is a trial assessor # features/trialsapi_steps.rb:19
And I accept JSON # features/trialsapi_steps.rb:15
Scenario: I can see my own trials and assessments # features/trialsapi_trials_source.feature:11
Given I am accessing the API as assessor # features/trialsapi_steps.rb:25
And there is a trial # features/trialsapi_steps.rb:29
And there is an assessment assigned to assessor named "TestThis!" # features/trialsapi_steps.rb:42
And I fetch "/trials_api/trials.json" # features/trialsapi_steps.rb:46
Then within a trial I should see the assessment named "TestThis!" # features/trialsapi_steps.rb:50
Scenario: I don't see other users stuff # features/trialsapi_trials_source.feature:19
Given I am accessing the API as nobody # features/trialsapi_steps.rb:37
And there is a trial # features/trialsapi_steps.rb:29
And there is an assessment assigned to assessor named "TestThis!" # features/trialsapi_steps.rb:42
And I fetch "/trials_api/trials.json" # features/trialsapi_steps.rb:46
Then I should see an empty list # features/trialsapi_steps.rb:69
8 scenarios (8 passed)
79 steps (79 passed)
0m9.259s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment