email_spec 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +14 -2
- data/Rakefile +6 -4
- data/examples/rails_root/config/boot.rb +1 -1
- data/examples/rails_root/config/cucumber.yml +7 -0
- data/examples/rails_root/config/database.yml +4 -1
- data/examples/rails_root/config/environment.rb +6 -1
- data/examples/rails_root/config/environments/cucumber.rb +29 -0
- data/examples/rails_root/config/environments/production.rb +11 -7
- data/examples/rails_root/config/environments/test.rb +5 -8
- data/examples/rails_root/features/step_definitions/web_steps.rb +273 -0
- data/examples/rails_root/features/support/env.rb +48 -20
- data/examples/rails_root/features/support/env_ext.rb +6 -0
- data/examples/rails_root/features/support/paths.rb +8 -2
- data/examples/rails_root/lib/tasks/cucumber.rake +47 -0
- data/examples/rails_root/rerun.txt +1 -0
- data/examples/rails_root/script/cucumber +6 -5
- data/examples/sinatra/app.rb +1 -1
- data/examples/sinatra/features/step_definitions/web_steps.rb +273 -0
- data/examples/sinatra/features/support/env.rb +15 -9
- data/lib/email_spec/background_processes.rb +19 -5
- data/lib/email_spec/email_viewer.rb +18 -2
- data/rails_generators/email_spec/templates/email_steps.rb +31 -22
- metadata +9 -4
- data/examples/rails_root/features/step_definitions/webrat_steps.rb +0 -137
- data/examples/sinatra/features/step_definitions/webrat_steps.rb +0 -137
data/History.txt
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
(In Git)
|
2
2
|
|
3
|
+
== 0.6.0 2010-03-05
|
4
|
+
|
3
5
|
=== New features
|
6
|
+
* Ability to open a list of attachments on an email (with corresponding steps and EmailViewer support). (Kieran Pilkington)
|
7
|
+
|
8
|
+
=== Bugfixes
|
9
|
+
* Spelling mistake in steps. (Ben Mabey)
|
10
|
+
* Delayed Job background processor fixes
|
11
|
+
* Narrow delayed job collisions with other apps defining Delayed constant. (Kieran Pilkington)
|
12
|
+
* Fix compatibility with earlier versions of DelayedJob (Michael Baumgarten and Kieran Pilkington)
|
13
|
+
|
14
|
+
=== Changes
|
15
|
+
* Deprecated steps were removed. (Kieran Pilkington)
|
4
16
|
|
5
17
|
=== Bufixes
|
6
18
|
|
@@ -8,7 +20,7 @@
|
|
8
20
|
|
9
21
|
=== New features
|
10
22
|
* "should receive <x> emails with subject <the_subject>" step definition (Balint Erdi)
|
11
|
-
* "should
|
23
|
+
* "should receive an email with the following body:" step definition (Ben Mabey)
|
12
24
|
* Debugging steps that tie into EmailViewer: (Ben Mabey)
|
13
25
|
* "save and open current email"
|
14
26
|
* "save and open all text emails"
|
@@ -16,7 +28,7 @@
|
|
16
28
|
* "save and open all raw emails"
|
17
29
|
|
18
30
|
=== Bufixes
|
19
|
-
*
|
31
|
+
* Gracefully handle cases where emails do not have a 'to' value. (Kieran Pilkington)
|
20
32
|
|
21
33
|
=== Bufixes
|
22
34
|
|
data/Rakefile
CHANGED
@@ -25,13 +25,15 @@ rescue LoadError
|
|
25
25
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
26
26
|
end
|
27
27
|
|
28
|
-
# TODO:
|
29
|
-
%w[
|
28
|
+
# TODO: switch to gem bundler
|
29
|
+
([['delayed_job', '1.8.4']] + %w[fixjour pony sinatra rack-test].map{|g| [g]}).each do |gem_args|
|
30
|
+
gem_name = gem_args.first
|
31
|
+
gem_version = gem_args.size > 1 ? gem_args[1] : nil
|
30
32
|
begin
|
31
|
-
gem
|
33
|
+
gem(*[gem_args].flatten)
|
32
34
|
rescue Gem::LoadError
|
33
35
|
puts "Installing #{gem_name} for the example rails app..."
|
34
|
-
puts `gem install #{gem_name} --no-rdoc --no-ri`
|
36
|
+
puts `gem install #{gem_name} #{gem_version ? ('--version='+gem_version) : ''} --no-rdoc --no-ri`
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -82,8 +82,8 @@ module Rails
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def load_rubygems
|
85
|
+
min_version = '1.3.2'
|
85
86
|
require 'rubygems'
|
86
|
-
min_version = '1.3.1'
|
87
87
|
unless rubygems_version >= min_version
|
88
88
|
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
89
|
exit 1
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%
|
2
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
|
5
|
+
%>
|
6
|
+
default: <%= std_opts %>
|
7
|
+
wip: --tags @wip:3 --wip features
|
@@ -9,7 +9,7 @@ development:
|
|
9
9
|
# Warning: The database defined as "test" will be erased and
|
10
10
|
# re-generated from your development database when you run "rake".
|
11
11
|
# Do not set this db to the same as development or production.
|
12
|
-
test:
|
12
|
+
test: &TEST
|
13
13
|
adapter: sqlite3
|
14
14
|
database: db/test.sqlite3
|
15
15
|
pool: 5
|
@@ -20,3 +20,6 @@ production:
|
|
20
20
|
database: db/production.sqlite3
|
21
21
|
pool: 5
|
22
22
|
timeout: 5000
|
23
|
+
|
24
|
+
cucumber:
|
25
|
+
<<: *TEST
|
@@ -5,13 +5,18 @@
|
|
5
5
|
# ENV['RAILS_ENV'] ||= 'production'
|
6
6
|
|
7
7
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
RAILS_GEM_VERSION = '2.3.
|
8
|
+
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
|
9
9
|
|
10
10
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
11
|
require File.join(File.dirname(__FILE__), 'boot')
|
12
12
|
|
13
13
|
Rails::Initializer.run do |config|
|
14
14
|
|
15
|
+
config.action_mailer.default_url_options = { :host => "example.com" }
|
16
|
+
|
17
|
+
config.gem 'fixjour', :lib => 'fixjour'
|
18
|
+
config.gem 'delayed_job', :lib => 'delayed_job'
|
19
|
+
|
15
20
|
config.time_zone = 'UTC'
|
16
21
|
|
17
22
|
config.action_controller.session = {
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Edit at your own peril - it's recommended to regenerate this file
|
2
|
+
# in the future when you upgrade to a newer version of Cucumber.
|
3
|
+
|
4
|
+
# IMPORTANT: Setting config.cache_classes to false is known to
|
5
|
+
# break Cucumber's use_transactional_fixtures method.
|
6
|
+
# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Disable request forgery protection in test environment
|
17
|
+
config.action_controller.allow_forgery_protection = false
|
18
|
+
|
19
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
20
|
+
# The :test delivery method accumulates sent emails in the
|
21
|
+
# ActionMailer::Base.deliveries array.
|
22
|
+
config.action_mailer.delivery_method = :test
|
23
|
+
|
24
|
+
config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
|
25
|
+
config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
26
|
+
config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
27
|
+
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
28
|
+
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
29
|
+
|
@@ -4,21 +4,25 @@
|
|
4
4
|
# Code is not reloaded between requests
|
5
5
|
config.cache_classes = true
|
6
6
|
|
7
|
-
# Enable threaded mode
|
8
|
-
# config.threadsafe!
|
9
|
-
|
10
|
-
# Use a different logger for distributed setups
|
11
|
-
# config.logger = SyslogLogger.new
|
12
|
-
|
13
7
|
# Full error reports are disabled and caching is turned on
|
14
8
|
config.action_controller.consider_all_requests_local = false
|
15
9
|
config.action_controller.perform_caching = true
|
10
|
+
config.action_view.cache_template_loading = true
|
11
|
+
|
12
|
+
# See everything in the log (default is :info)
|
13
|
+
# config.log_level = :debug
|
14
|
+
|
15
|
+
# Use a different logger for distributed setups
|
16
|
+
# config.logger = SyslogLogger.new
|
16
17
|
|
17
18
|
# Use a different cache store in production
|
18
19
|
# config.cache_store = :mem_cache_store
|
19
20
|
|
20
21
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
21
|
-
# config.action_controller.asset_host
|
22
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
22
23
|
|
23
24
|
# Disable delivery errors, bad email addresses will be ignored
|
24
25
|
# config.action_mailer.raise_delivery_errors = false
|
26
|
+
|
27
|
+
# Enable threaded mode
|
28
|
+
# config.threadsafe!
|
@@ -12,6 +12,7 @@ config.whiny_nils = true
|
|
12
12
|
# Show full error reports and disable caching
|
13
13
|
config.action_controller.consider_all_requests_local = true
|
14
14
|
config.action_controller.perform_caching = false
|
15
|
+
config.action_view.cache_template_loading = true
|
15
16
|
|
16
17
|
# Disable request forgery protection in test environment
|
17
18
|
config.action_controller.allow_forgery_protection = false
|
@@ -20,12 +21,8 @@ config.action_controller.allow_forgery_protection = false
|
|
20
21
|
# The :test delivery method accumulates sent emails in the
|
21
22
|
# ActionMailer::Base.deliveries array.
|
22
23
|
config.action_mailer.delivery_method = :test
|
23
|
-
config.action_mailer.default_url_options = { :host => "example.com" }
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
config.
|
29
|
-
config.gem 'rspec-rails', :lib => 'spec/rails'
|
30
|
-
config.gem 'fixjour', :lib => 'fixjour'
|
31
|
-
config.gem 'collectiveidea-delayed_job', :lib => 'delayed_job', :source => 'http://gems.github.com'
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
@@ -0,0 +1,273 @@
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
6
|
+
|
7
|
+
|
8
|
+
require 'uri'
|
9
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
10
|
+
|
11
|
+
# Commonly used webrat steps
|
12
|
+
# http://github.com/brynary/webrat
|
13
|
+
|
14
|
+
Given /^(?:|I )am on (.+)$/ do |page_name|
|
15
|
+
visit path_to(page_name)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^(?:|I )go to (.+)$/ do |page_name|
|
19
|
+
visit path_to(page_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^(?:|I )press "([^\"]*)"$/ do |button|
|
23
|
+
click_button(button)
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^(?:|I )follow "([^\"]*)"$/ do |link|
|
27
|
+
click_link(link)
|
28
|
+
end
|
29
|
+
|
30
|
+
When /^(?:|I )follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
|
31
|
+
click_link_within(parent, link)
|
32
|
+
end
|
33
|
+
|
34
|
+
When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
35
|
+
fill_in(field, :with => value)
|
36
|
+
end
|
37
|
+
|
38
|
+
When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
|
39
|
+
fill_in(field, :with => value)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Use this to fill in an entire form with data from a table. Example:
|
43
|
+
#
|
44
|
+
# When I fill in the following:
|
45
|
+
# | Account Number | 5002 |
|
46
|
+
# | Expiry date | 2009-11-01 |
|
47
|
+
# | Note | Nice guy |
|
48
|
+
# | Wants Email? | |
|
49
|
+
#
|
50
|
+
# TODO: Add support for checkbox, select og option
|
51
|
+
# based on naming conventions.
|
52
|
+
#
|
53
|
+
When /^(?:|I )fill in the following:$/ do |fields|
|
54
|
+
fields.rows_hash.each do |name, value|
|
55
|
+
When %{I fill in "#{name}" with "#{value}"}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
When /^(?:|I )select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
60
|
+
select(value, :from => field)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
64
|
+
# When I select "December 25, 2008 10:00" as the date and time
|
65
|
+
When /^(?:|I )select "([^\"]*)" as the date and time$/ do |time|
|
66
|
+
select_datetime(time)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Use this step when using multiple datetime_select helpers on a page or
|
70
|
+
# you want to specify which datetime to select. Given the following view:
|
71
|
+
# <%= f.label :preferred %><br />
|
72
|
+
# <%= f.datetime_select :preferred %>
|
73
|
+
# <%= f.label :alternative %><br />
|
74
|
+
# <%= f.datetime_select :alternative %>
|
75
|
+
# The following steps would fill out the form:
|
76
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
77
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
78
|
+
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
79
|
+
select_datetime(datetime, :from => datetime_label)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Use this step in conjunction with Rail's time_select helper. For example:
|
83
|
+
# When I select "2:20PM" as the time
|
84
|
+
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
85
|
+
# will convert the 2:20PM to 14:20 and then select it.
|
86
|
+
When /^(?:|I )select "([^\"]*)" as the time$/ do |time|
|
87
|
+
select_time(time)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Use this step when using multiple time_select helpers on a page or you want to
|
91
|
+
# specify the name of the time on the form. For example:
|
92
|
+
# When I select "7:30AM" as the "Gym" time
|
93
|
+
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
94
|
+
select_time(time, :from => time_label)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Use this step in conjunction with Rail's date_select helper. For example:
|
98
|
+
# When I select "February 20, 1981" as the date
|
99
|
+
When /^(?:|I )select "([^\"]*)" as the date$/ do |date|
|
100
|
+
select_date(date)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Use this step when using multiple date_select helpers on one page or
|
104
|
+
# you want to specify the name of the date on the form. For example:
|
105
|
+
# When I select "April 26, 1982" as the "Date of Birth" date
|
106
|
+
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
107
|
+
select_date(date, :from => date_label)
|
108
|
+
end
|
109
|
+
|
110
|
+
When /^(?:|I )check "([^\"]*)"$/ do |field|
|
111
|
+
check(field)
|
112
|
+
end
|
113
|
+
|
114
|
+
When /^(?:|I )uncheck "([^\"]*)"$/ do |field|
|
115
|
+
uncheck(field)
|
116
|
+
end
|
117
|
+
|
118
|
+
When /^(?:|I )choose "([^\"]*)"$/ do |field|
|
119
|
+
choose(field)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Adds support for validates_attachment_content_type. Without the mime-type getting
|
123
|
+
# passed to attach_file() you will get a "Photo file is not one of the allowed file types."
|
124
|
+
# error message
|
125
|
+
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
126
|
+
type = path.split(".")[1]
|
127
|
+
|
128
|
+
case type
|
129
|
+
when "jpg"
|
130
|
+
type = "image/jpg"
|
131
|
+
when "jpeg"
|
132
|
+
type = "image/jpeg"
|
133
|
+
when "png"
|
134
|
+
type = "image/png"
|
135
|
+
when "gif"
|
136
|
+
type = "image/gif"
|
137
|
+
end
|
138
|
+
|
139
|
+
attach_file(field, path, type)
|
140
|
+
end
|
141
|
+
|
142
|
+
Then /^(?:|I )should see "([^\"]*)"$/ do |text|
|
143
|
+
if defined?(Spec::Rails::Matchers)
|
144
|
+
response.should contain(text)
|
145
|
+
else
|
146
|
+
assert_contain text
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
151
|
+
within(selector) do |content|
|
152
|
+
if defined?(Spec::Rails::Matchers)
|
153
|
+
content.should contain(text)
|
154
|
+
else
|
155
|
+
hc = Webrat::Matchers::HasContent.new(text)
|
156
|
+
assert hc.matches?(content), hc.failure_message
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
162
|
+
regexp = Regexp.new(regexp)
|
163
|
+
if defined?(Spec::Rails::Matchers)
|
164
|
+
response.should contain(regexp)
|
165
|
+
else
|
166
|
+
assert_match(regexp, response_body)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
171
|
+
within(selector) do |content|
|
172
|
+
regexp = Regexp.new(regexp)
|
173
|
+
if defined?(Spec::Rails::Matchers)
|
174
|
+
content.should contain(regexp)
|
175
|
+
else
|
176
|
+
assert_match(regexp, content)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
|
182
|
+
if defined?(Spec::Rails::Matchers)
|
183
|
+
response.should_not contain(text)
|
184
|
+
else
|
185
|
+
assert_not_contain(text)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
190
|
+
within(selector) do |content|
|
191
|
+
if defined?(Spec::Rails::Matchers)
|
192
|
+
content.should_not contain(text)
|
193
|
+
else
|
194
|
+
hc = Webrat::Matchers::HasContent.new(text)
|
195
|
+
assert !hc.matches?(content), hc.negative_failure_message
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
201
|
+
regexp = Regexp.new(regexp)
|
202
|
+
if defined?(Spec::Rails::Matchers)
|
203
|
+
response.should_not contain(regexp)
|
204
|
+
else
|
205
|
+
assert_not_contain(regexp)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
210
|
+
within(selector) do |content|
|
211
|
+
regexp = Regexp.new(regexp)
|
212
|
+
if defined?(Spec::Rails::Matchers)
|
213
|
+
content.should_not contain(regexp)
|
214
|
+
else
|
215
|
+
assert_no_match(regexp, content)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
221
|
+
if defined?(Spec::Rails::Matchers)
|
222
|
+
field_labeled(field).value.should =~ /#{value}/
|
223
|
+
else
|
224
|
+
assert_match(/#{value}/, field_labeled(field).value)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
229
|
+
if defined?(Spec::Rails::Matchers)
|
230
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
231
|
+
else
|
232
|
+
assert_no_match(/#{value}/, field_labeled(field).value)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
237
|
+
if defined?(Spec::Rails::Matchers)
|
238
|
+
field_labeled(label).should be_checked
|
239
|
+
else
|
240
|
+
assert field_labeled(label).checked?
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
245
|
+
if defined?(Spec::Rails::Matchers)
|
246
|
+
field_labeled(label).should_not be_checked
|
247
|
+
else
|
248
|
+
assert !field_labeled(label).checked?
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
253
|
+
if defined?(Spec::Rails::Matchers)
|
254
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
255
|
+
else
|
256
|
+
assert_equal path_to(page_name), URI.parse(current_url).path
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
261
|
+
actual_params = CGI.parse(URI.parse(current_url).query)
|
262
|
+
expected_params = Hash[expected_pairs.rows_hash.map{|k,v| [k,[v]]}]
|
263
|
+
|
264
|
+
if defined?(Spec::Rails::Matchers)
|
265
|
+
actual_params.should == expected_params
|
266
|
+
else
|
267
|
+
assert_equal expected_params, actual_params
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
Then /^show me the page$/ do
|
272
|
+
save_and_open_page
|
273
|
+
end
|