Skip to content

Commit

Permalink
Shortened steps' names.
Browse files Browse the repository at this point in the history
  • Loading branch information
baldowl committed May 8, 2009
1 parent f2c0f40 commit 01206cf
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions features/empty_responses.feature
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Feature: Handling of the HTTP requests returning an empty response

Scenario: GET request with CSRF token
Given a Rack setup with the anti-CSRF middleware
Given a rack with the anti-CSRF middleware
When it receives a GET request with the CSRF token
Then it lets it pass untouched

Scenario: GET request without CSRF token
Given a Rack setup with the anti-CSRF middleware
Given a rack with the anti-CSRF middleware
When it receives a GET request without the CSRF token
Then it lets it pass untouched

Scenario Outline: Handling request without CSRF token
Given a Rack setup with the anti-CSRF middleware
Given a rack with the anti-CSRF middleware
When it receives a <method> request without the CSRF token
Then it responds with 417
And the response body is empty
Expand All @@ -23,7 +23,7 @@ Feature: Handling of the HTTP requests returning an empty response
| DELETE |

Scenario Outline: Handling request with the right CSRF token
Given a Rack setup with the anti-CSRF middleware
Given a rack with the anti-CSRF middleware
When it receives a <method> request with the right CSRF token
Then it lets it pass untouched

Expand All @@ -34,7 +34,7 @@ Feature: Handling of the HTTP requests returning an empty response
| DELETE |

Scenario Outline: Handling request with the wrong CSRF token
Given a Rack setup with the anti-CSRF middleware
Given a rack with the anti-CSRF middleware
When it receives a <method> request with the wrong CSRF token
Then it responds with 417
And the response body is empty
Expand Down
8 changes: 4 additions & 4 deletions features/raising_exception.feature
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Feature: Handling of the HTTP requests raising an exception

Scenario: GET request without CSRF token
Given a Rack setup with the anti-CSRF middleware and the :raise option
Given a rack with the anti-CSRF middleware and the :raise option
When it receives a GET request without the CSRF token
Then it lets it pass untouched

Scenario Outline: Handling request without CSRF token
Given a Rack setup with the anti-CSRF middleware and the :raise option
Given a rack with the anti-CSRF middleware and the :raise option
When it receives a <method> request without the CSRF token
Then there is no response
And an exception is climbing up the stack
Expand All @@ -18,7 +18,7 @@ Feature: Handling of the HTTP requests raising an exception
| DELETE |

Scenario Outline: Handling request with the right CSRF token
Given a Rack setup with the anti-CSRF middleware and the :raise option
Given a rack with the anti-CSRF middleware and the :raise option
When it receives a <method> request with the right CSRF token
Then it lets it pass untouched

Expand All @@ -29,7 +29,7 @@ Feature: Handling of the HTTP requests raising an exception
| DELETE |

Scenario Outline: Handling request with the wrong CSRF token
Given a Rack setup with the anti-CSRF middleware and the :raise option
Given a rack with the anti-CSRF middleware and the :raise option
When it receives a <method> request with the wrong CSRF token
Then there is no response
And an exception is climbing up the stack
Expand Down
10 changes: 5 additions & 5 deletions features/setup.feature
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
Feature: Setup of the middleware

Scenario: Simple setup with session support
Given a Rack setup with the session middleware
Given a rack with the session middleware
When I insert the anti-CSRF middleware
Then I get a fully functional rack

Scenario: Simple setup without session support
Given a Rack setup without the session middleware
Given a rack without the session middleware
When I insert the anti-CSRF middleware
Then I get an error message

Scenario: Setup with :raise option
Given a Rack setup with the session middleware
Given a rack with the session middleware
When I insert the anti-CSRF middleware with the :raise option
Then I get a fully functional rack

Scenario: Setup with the :skip option
Given a Rack setup with the session middleware
Given a rack with the session middleware
When I insert the anti-CSRF middleware with the :skip option
| route |
| POST:/not_checking |
| PUT:/is_wrong |
Then I get a fully functional rack

Scenario: Setup with the :field option
Given a Rack setup with the session middleware
Given a rack with the session middleware
When I insert the anti-CSRF middleware with the :field option
Then I get a fully functional rack
4 changes: 2 additions & 2 deletions features/skip_some_routes.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Skipping the check for some specific routes

Scenario Outline: Skipping the check for some requests
Given a Rack setup with the anti-CSRF middleware and the :skip option
Given a rack with the anti-CSRF middleware and the :skip option
| pair |
| POST:/not_checking |
| PUT:/is_wrong |
Expand All @@ -19,7 +19,7 @@ Feature: Skipping the check for some specific routes
| DELETE | /cars/abc123.xml |

Scenario Outline: Keep checking the requests for other method/path pairs
Given a Rack setup with the anti-CSRF middleware and the :skip option
Given a rack with the anti-CSRF middleware and the :skip option
| pair |
| POST:/not_checking |
| PUT:/is_wrong |
Expand Down
18 changes: 9 additions & 9 deletions features/step_definitions/setup_steps.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Given /^a Rack setup (with|without) the session middleware$/ do |prep|
Given /^a rack (with|without) the session middleware$/ do |prep|
@rack_builder = Rack::Builder.new
@rack_builder.use FakeSession if prep == 'with'
end

# Yes, they're not as DRY as possible, but I think they're more readable than
# a single step definition with a few captures and more complex checkings.

Given /^a Rack setup with the anti\-CSRF middleware$/ do
Given 'a Rack setup with the session middleware'
Given /^a rack with the anti\-CSRF middleware$/ do
Given 'a rack with the session middleware'
When 'I insert the anti-CSRF middleware'
end

Given /^a Rack setup with the anti\-CSRF middleware and the :raise option$/ do
Given 'a Rack setup with the session middleware'
Given /^a rack with the anti\-CSRF middleware and the :raise option$/ do
Given 'a rack with the session middleware'
When 'I insert the anti-CSRF middleware with the :raise option'
end

Given /^a Rack setup with the anti\-CSRF middleware and the :skip option$/ do |table|
Given 'a Rack setup with the session middleware'
Given /^a rack with the anti\-CSRF middleware and the :skip option$/ do |table|
Given 'a rack with the session middleware'
When 'I insert the anti-CSRF middleware with the :skip option', table
end

Given /^a Rack setup with the anti\-CSRF middleware and the :field option$/ do
Given 'a Rack setup with the session middleware'
Given /^a rack with the anti\-CSRF middleware and the :field option$/ do
Given 'a rack with the session middleware'
When 'I insert the anti-CSRF middleware with the :field option'
end

Expand Down
6 changes: 3 additions & 3 deletions features/variation_on_field_name.feature
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Feature: Customization of the field name

Scenario: GET request with CSRF token in custom field
Given a Rack setup with the anti-CSRF middleware and the :field option
Given a rack with the anti-CSRF middleware and the :field option
When it receives a GET request with the CSRF token
Then it lets it pass untouched

Scenario Outline: Handling request with the right CSRF token in custom field
Given a Rack setup with the anti-CSRF middleware and the :field option
Given a rack with the anti-CSRF middleware and the :field option
When it receives a <method> request with the right CSRF token
Then it lets it pass untouched

Expand All @@ -17,7 +17,7 @@ Feature: Customization of the field name
| DELETE |

Scenario Outline: Handling request with the wrong CSRF token in custom field
Given a Rack setup with the anti-CSRF middleware and the :field option
Given a rack with the anti-CSRF middleware and the :field option
When it receives a <method> request with the wrong CSRF token
Then it responds with 417
And the response body is empty
Expand Down

0 comments on commit 01206cf

Please sign in to comment.