prodder-steps 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Prodder::Steps
1
+ # Prodder Steps
2
2
 
3
3
  [Prodder](https://github.com/garethr/prodder/) is a set of cucumber
4
4
  features for testing various aspects of web application security. This
@@ -4,6 +4,10 @@ def canonical_header(header)
4
4
  header.downcase.gsub('-', '_').to_sym
5
5
  end
6
6
 
7
+ def header_includes_attribute?(header, attribute)
8
+ @response.headers[canonical_header(header)].to_s.should =~ /#{attribute}/
9
+ end
10
+
7
11
  When(/^we request the site over "(.*?)"$/) do |protocol|
8
12
  @response = RestClient.get "#{protocol.downcase}://#{ENV['HOST']}"
9
13
  end
@@ -20,6 +24,10 @@ Then(/^the "(.*?)" header should be set$/) do |header|
20
24
  @response.headers.should have_key(canonical_header(header))
21
25
  end
22
26
 
23
- Then(/^the "(.*?)" header should have the "(.*?)" attribute$/) do |header, attribute|
24
- @response.headers[canonical_header(header)].to_s.should =~ /#{attribute}/
27
+ Then(/^(if present, )?the "(.*?)" header should have the "(.*?)" attribute$/) do |optional, header, attribute|
28
+ if optional
29
+ header_includes_attribute?(header, attribute) if @response.headers[canonical_header(header)]
30
+ else
31
+ header_includes_attribute?(header, attribute)
32
+ end
25
33
  end
@@ -1,5 +1,5 @@
1
1
  module Prodder
2
2
  module Steps
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prodder-steps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: -4184300659337990794
145
+ hash: 284679941429222512
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements:
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: -4184300659337990794
154
+ hash: 284679941429222512
155
155
  requirements: []
156
156
  rubyforge_project:
157
157
  rubygems_version: 1.8.24