email_spec 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,20 +1,23 @@
|
|
1
|
-
#
|
2
|
-
ENV["
|
3
|
-
|
1
|
+
# Sinatra configuration - http://wiki.github.com/aslakhellesoy/cucumber/sinatra
|
2
|
+
ENV["RAILS_ENV"] ||= "cucumber"
|
3
|
+
app_file = File.expand_path(File.dirname(__FILE__) + '/../../app.rb')
|
4
|
+
require app_file
|
5
|
+
# Force the application name because polyglot breaks the auto-detection logic.
|
6
|
+
Sinatra::Application.app_file = app_file
|
4
7
|
|
5
|
-
|
6
|
-
require 'cucumber/
|
8
|
+
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
9
|
+
require 'cucumber/web/tableish'
|
7
10
|
|
11
|
+
require 'spec/expectations'
|
8
12
|
require 'rack/test'
|
13
|
+
require 'test/unit'
|
9
14
|
require 'webrat'
|
10
|
-
require 'cucumber/webrat/table_locator' # Lets you do table.diff!(table_at('#my_table').to_a)
|
11
15
|
|
12
16
|
Webrat.configure do |config|
|
13
17
|
config.mode = :rack
|
18
|
+
config.open_error_files = false # Set to true if you want error pages to pop up in the browser
|
14
19
|
end
|
15
20
|
|
16
|
-
require 'webrat/core/matchers'
|
17
|
-
|
18
21
|
# email testing in cucumber
|
19
22
|
require 'activesupport'
|
20
23
|
require File.expand_path(File.dirname(__FILE__) + '../../../../../lib/email_spec')
|
@@ -22,12 +25,15 @@ require 'email_spec/cucumber'
|
|
22
25
|
|
23
26
|
class AppWorld
|
24
27
|
include Rack::Test::Methods
|
28
|
+
include Test::Unit::Assertions
|
25
29
|
include Webrat::Methods
|
26
30
|
include Webrat::Matchers
|
27
31
|
|
32
|
+
Webrat::Methods.delegate_to_session :response_code, :response_body
|
33
|
+
|
28
34
|
def app
|
29
35
|
Sinatra::Application.new
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
33
|
-
World { AppWorld.new }
|
39
|
+
World { AppWorld.new }
|
@@ -2,28 +2,42 @@ module EmailSpec
|
|
2
2
|
module BackgroundProcesses
|
3
3
|
module DelayedJob
|
4
4
|
def all_emails
|
5
|
-
|
5
|
+
work_off_queue
|
6
6
|
super
|
7
7
|
end
|
8
8
|
|
9
9
|
def last_email_sent
|
10
|
-
|
10
|
+
work_off_queue
|
11
11
|
super
|
12
12
|
end
|
13
13
|
|
14
14
|
def reset_mailer
|
15
|
-
|
15
|
+
work_off_queue
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
19
19
|
def mailbox_for(address)
|
20
|
-
|
20
|
+
work_off_queue
|
21
21
|
super
|
22
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Later versions of DelayedJob switch from using Delayed::Job to Delayed::Worker
|
27
|
+
# Support both versions for those who haven't upgraded yet
|
28
|
+
def work_off_queue
|
29
|
+
if defined?(Delayed::Job)
|
30
|
+
Delayed::Job.work_off
|
31
|
+
else
|
32
|
+
Delayed::Worker.send :public, :work_off
|
33
|
+
worker = Delayed::Worker.new(:max_priority => nil, :min_priority => nil, :quiet => true)
|
34
|
+
worker.work_off
|
35
|
+
end
|
36
|
+
end
|
23
37
|
end
|
24
38
|
|
25
39
|
module Compatibility
|
26
|
-
if defined?(Delayed)
|
40
|
+
if defined?(Delayed) && (defined?(Delayed::Job) || defined?(Delayed::Worker))
|
27
41
|
include EmailSpec::BackgroundProcesses::DelayedJob
|
28
42
|
end
|
29
43
|
end
|
@@ -3,7 +3,7 @@ module EmailSpec
|
|
3
3
|
extend Deliveries
|
4
4
|
|
5
5
|
def self.save_and_open_all_raw_emails
|
6
|
-
filename =
|
6
|
+
filename = tmp_email_filename
|
7
7
|
|
8
8
|
File.open(filename, "w") do |f|
|
9
9
|
all_emails.each do |m|
|
@@ -46,7 +46,7 @@ module EmailSpec
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.save_and_open_email(mail)
|
49
|
-
filename =
|
49
|
+
filename = tmp_email_filename
|
50
50
|
|
51
51
|
File.open(filename, "w") do |f|
|
52
52
|
f.write mail.to_s
|
@@ -55,6 +55,22 @@ module EmailSpec
|
|
55
55
|
open_in_text_editor(filename)
|
56
56
|
end
|
57
57
|
|
58
|
+
def self.save_and_open_email_attachments_list(mail)
|
59
|
+
filename = tmp_email_filename
|
60
|
+
|
61
|
+
File.open(filename, "w") do |f|
|
62
|
+
mail.attachments.each_with_index do |attachment, index|
|
63
|
+
info = "#{index + 1}:"
|
64
|
+
info += "\n\tfilename: #{attachment.original_filename}"
|
65
|
+
info += "\n\tcontent type: #{attachment.content_type}"
|
66
|
+
info += "\n\tsize: #{attachment.size}"
|
67
|
+
f.write info + "\n"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
open_in_text_editor(filename)
|
72
|
+
end
|
73
|
+
|
58
74
|
# TODO: use the launchy gem for this stuff...
|
59
75
|
def self.open_in_text_editor(filename)
|
60
76
|
`open #{filename}`
|
@@ -60,20 +60,10 @@ Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([
|
|
60
60
|
unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size.should == parse_email_count(amount)
|
61
61
|
end
|
62
62
|
|
63
|
-
Then /^(?:I|they|"([^"]*?)") should
|
63
|
+
Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body|
|
64
64
|
open_email(address, :with_text => expected_body)
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
|
-
# DEPRECATED
|
69
|
-
# The following methods are left in for backwards compatibility and
|
70
|
-
# should be removed by version 0.4.0
|
71
|
-
Then /^(?:I|they|"([^"]*?)") should not receive an email$/ do |address|
|
72
|
-
email_spec_deprecate "The step 'I/they/[email] should not receive an email' is no longer supported.
|
73
|
-
Please use 'I/they/[email] should receive no emails' instead."
|
74
|
-
unread_emails_for(address).size.should == 0
|
75
|
-
end
|
76
|
-
|
77
67
|
#
|
78
68
|
# Accessing emails
|
79
69
|
#
|
@@ -123,19 +113,38 @@ Then /^(?:I|they) should see \/([^\"]*)\/ in the email "([^"]*?)" header$/ do |t
|
|
123
113
|
current_email.should have_header(name, Regexp.new(text))
|
124
114
|
end
|
125
115
|
|
116
|
+
#
|
117
|
+
# Inspect the Email Attachments
|
118
|
+
#
|
119
|
+
|
120
|
+
Then /^(?:I|they) should see (\d+) attachments? with the email$/ do |amount|
|
121
|
+
current_email.attachments.size.should == amount.to_i
|
122
|
+
end
|
126
123
|
|
127
|
-
|
128
|
-
|
129
|
-
# should be removed by version 0.4.0.
|
130
|
-
Then /^(?:I|they) should see "([^"]*?)" in the subject$/ do |text|
|
131
|
-
email_spec_deprecate "The step 'I/they should see [text] in the subject' is no longer supported.
|
132
|
-
Please use 'I/they should see [text] in the email subject' instead."
|
133
|
-
current_email.should have_subject(Regexp.new(text))
|
124
|
+
Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename|
|
125
|
+
current_email.attachments.select { |a| a.original_filename == filename }.size.should == parse_email_count(amount)
|
134
126
|
end
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
127
|
+
|
128
|
+
Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
|
129
|
+
current_email.attachments[(index.to_i - 1)].original_filename.should == filename
|
130
|
+
end
|
131
|
+
|
132
|
+
Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type|
|
133
|
+
current_email.attachments.select { |a| a.content_type == content_type }.size.should == parse_email_count(amount)
|
134
|
+
end
|
135
|
+
|
136
|
+
Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type|
|
137
|
+
current_email.attachments[(index.to_i - 1)].content_type.should == content_type
|
138
|
+
end
|
139
|
+
|
140
|
+
Then /^all attachments should not be blank$/ do
|
141
|
+
current_email.attachments.each do |attachment|
|
142
|
+
attachment.size.should_not == 0
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
Then /^show me a list of email attachments$/ do
|
147
|
+
EmailSpec::EmailViewer::save_and_open_email_attachments_list(current_email)
|
139
148
|
end
|
140
149
|
|
141
150
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Mabey
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-
|
14
|
+
date: 2010-03-05 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|
@@ -86,8 +86,10 @@ test_files:
|
|
86
86
|
- examples/rails_root/app/views/welcome/newsletter.html.erb
|
87
87
|
- examples/rails_root/app/views/welcome/signup.html.erb
|
88
88
|
- examples/rails_root/config/boot.rb
|
89
|
+
- examples/rails_root/config/cucumber.yml
|
89
90
|
- examples/rails_root/config/database.yml
|
90
91
|
- examples/rails_root/config/environment.rb
|
92
|
+
- examples/rails_root/config/environments/cucumber.rb
|
91
93
|
- examples/rails_root/config/environments/development.rb
|
92
94
|
- examples/rails_root/config/environments/production.rb
|
93
95
|
- examples/rails_root/config/environments/test.rb
|
@@ -103,9 +105,11 @@ test_files:
|
|
103
105
|
- examples/rails_root/features/errors.feature
|
104
106
|
- examples/rails_root/features/example.feature
|
105
107
|
- examples/rails_root/features/step_definitions/user_steps.rb
|
106
|
-
- examples/rails_root/features/step_definitions/
|
108
|
+
- examples/rails_root/features/step_definitions/web_steps.rb
|
107
109
|
- examples/rails_root/features/support/env.rb
|
110
|
+
- examples/rails_root/features/support/env_ext.rb
|
108
111
|
- examples/rails_root/features/support/paths.rb
|
112
|
+
- examples/rails_root/lib/tasks/cucumber.rake
|
109
113
|
- examples/rails_root/public/404.html
|
110
114
|
- examples/rails_root/public/422.html
|
111
115
|
- examples/rails_root/public/500.html
|
@@ -119,6 +123,7 @@ test_files:
|
|
119
123
|
- examples/rails_root/public/javascripts/prototype.js
|
120
124
|
- examples/rails_root/public/robots.txt
|
121
125
|
- examples/rails_root/Rakefile
|
126
|
+
- examples/rails_root/rerun.txt
|
122
127
|
- examples/rails_root/script/about
|
123
128
|
- examples/rails_root/script/autospec
|
124
129
|
- examples/rails_root/script/console
|
@@ -149,6 +154,6 @@ test_files:
|
|
149
154
|
- examples/sinatra/features/errors.feature
|
150
155
|
- examples/sinatra/features/example.feature
|
151
156
|
- examples/sinatra/features/step_definitions/user_steps.rb
|
152
|
-
- examples/sinatra/features/step_definitions/
|
157
|
+
- examples/sinatra/features/step_definitions/web_steps.rb
|
153
158
|
- examples/sinatra/features/support/env.rb
|
154
159
|
- examples/sinatra/features/support/paths.rb
|
@@ -1,137 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
2
|
-
|
3
|
-
# Commonly used webrat steps
|
4
|
-
# http://github.com/brynary/webrat
|
5
|
-
|
6
|
-
Given /^I am on (.+)$/ do |page_name|
|
7
|
-
visit path_to(page_name)
|
8
|
-
end
|
9
|
-
|
10
|
-
When /^I go to (.+)$/ do |page_name|
|
11
|
-
visit path_to(page_name)
|
12
|
-
end
|
13
|
-
|
14
|
-
When /^I press "([^\"]*)"$/ do |button|
|
15
|
-
click_button(button)
|
16
|
-
end
|
17
|
-
|
18
|
-
When /^I follow "([^\"]*)"$/ do |link|
|
19
|
-
click_link(link)
|
20
|
-
end
|
21
|
-
|
22
|
-
When /^I follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
|
23
|
-
click_link_within(parent, link)
|
24
|
-
end
|
25
|
-
|
26
|
-
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
27
|
-
fill_in(field, :with => value)
|
28
|
-
end
|
29
|
-
|
30
|
-
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
31
|
-
select(value, :from => field)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
35
|
-
# When I select "December 25, 2008 10:00" as the date and time
|
36
|
-
When /^I select "([^\"]*)" as the date and time$/ do |time|
|
37
|
-
select_datetime(time)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Use this step when using multiple datetime_select helpers on a page or
|
41
|
-
# you want to specify which datetime to select. Given the following view:
|
42
|
-
# <%%= f.label :preferred %><br />
|
43
|
-
# <%%= f.datetime_select :preferred %>
|
44
|
-
# <%%= f.label :alternative %><br />
|
45
|
-
# <%%= f.datetime_select :alternative %>
|
46
|
-
# The following steps would fill out the form:
|
47
|
-
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
48
|
-
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
49
|
-
When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
50
|
-
select_datetime(datetime, :from => datetime_label)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Use this step in conjunction with Rail's time_select helper. For example:
|
54
|
-
# When I select "2:20PM" as the time
|
55
|
-
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
56
|
-
# will convert the 2:20PM to 14:20 and then select it.
|
57
|
-
When /^I select "([^\"]*)" as the time$/ do |time|
|
58
|
-
select_time(time)
|
59
|
-
end
|
60
|
-
|
61
|
-
# Use this step when using multiple time_select helpers on a page or you want to
|
62
|
-
# specify the name of the time on the form. For example:
|
63
|
-
# When I select "7:30AM" as the "Gym" time
|
64
|
-
When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
65
|
-
select_time(time, :from => time_label)
|
66
|
-
end
|
67
|
-
|
68
|
-
# Use this step in conjunction with Rail's date_select helper. For example:
|
69
|
-
# When I select "February 20, 1981" as the date
|
70
|
-
When /^I select "([^\"]*)" as the date$/ do |date|
|
71
|
-
select_date(date)
|
72
|
-
end
|
73
|
-
|
74
|
-
# Use this step when using multiple date_select helpers on one page or
|
75
|
-
# you want to specify the name of the date on the form. For example:
|
76
|
-
# When I select "April 26, 1982" as the "Date of Birth" date
|
77
|
-
When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
78
|
-
select_date(date, :from => date_label)
|
79
|
-
end
|
80
|
-
|
81
|
-
When /^I check "([^\"]*)"$/ do |field|
|
82
|
-
check(field)
|
83
|
-
end
|
84
|
-
|
85
|
-
When /^I uncheck "([^\"]*)"$/ do |field|
|
86
|
-
uncheck(field)
|
87
|
-
end
|
88
|
-
|
89
|
-
When /^I choose "([^\"]*)"$/ do |field|
|
90
|
-
choose(field)
|
91
|
-
end
|
92
|
-
|
93
|
-
When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
94
|
-
attach_file(field, path)
|
95
|
-
end
|
96
|
-
|
97
|
-
Then /^I should see "([^\"]*)"$/ do |text|
|
98
|
-
response_body.should contain(text)
|
99
|
-
end
|
100
|
-
|
101
|
-
Then /^I should see \/([^\/]*)\/$/ do |regexp|
|
102
|
-
regexp = Regexp.new(regexp)
|
103
|
-
response_body.should contain(regexp)
|
104
|
-
end
|
105
|
-
|
106
|
-
Then /^I should not see "([^\"]*)"$/ do |text|
|
107
|
-
response_body.should_not contain(text)
|
108
|
-
end
|
109
|
-
|
110
|
-
Then /^I should not see \/([^\/]*)\/$/ do |regexp|
|
111
|
-
regexp = Regexp.new(regexp)
|
112
|
-
response_body.should_not contain(regexp)
|
113
|
-
end
|
114
|
-
|
115
|
-
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
116
|
-
field_labeled(field).value.should =~ /#{value}/
|
117
|
-
end
|
118
|
-
|
119
|
-
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
120
|
-
field_labeled(field).value.should_not =~ /#{value}/
|
121
|
-
end
|
122
|
-
|
123
|
-
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
124
|
-
field_labeled(label).should be_checked
|
125
|
-
end
|
126
|
-
|
127
|
-
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
128
|
-
field_labeled(label).should_not be_checked
|
129
|
-
end
|
130
|
-
|
131
|
-
Then /^I should be on (.+)$/ do |page_name|
|
132
|
-
URI.parse(current_url).path.should == path_to(page_name)
|
133
|
-
end
|
134
|
-
|
135
|
-
Then /^show me the page$/ do
|
136
|
-
save_and_open_page
|
137
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
2
|
-
|
3
|
-
# Commonly used webrat steps
|
4
|
-
# http://github.com/brynary/webrat
|
5
|
-
|
6
|
-
Given /^I am on (.+)$/ do |page_name|
|
7
|
-
visit path_to(page_name)
|
8
|
-
end
|
9
|
-
|
10
|
-
When /^I go to (.+)$/ do |page_name|
|
11
|
-
visit path_to(page_name)
|
12
|
-
end
|
13
|
-
|
14
|
-
When /^I press "([^\"]*)"$/ do |button|
|
15
|
-
click_button(button)
|
16
|
-
end
|
17
|
-
|
18
|
-
When /^I follow "([^\"]*)"$/ do |link|
|
19
|
-
click_link(link)
|
20
|
-
end
|
21
|
-
|
22
|
-
When /^I follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
|
23
|
-
click_link_within(parent, link)
|
24
|
-
end
|
25
|
-
|
26
|
-
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
27
|
-
fill_in(field, :with => value)
|
28
|
-
end
|
29
|
-
|
30
|
-
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
31
|
-
select(value, :from => field)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
35
|
-
# When I select "December 25, 2008 10:00" as the date and time
|
36
|
-
When /^I select "([^\"]*)" as the date and time$/ do |time|
|
37
|
-
select_datetime(time)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Use this step when using multiple datetime_select helpers on a page or
|
41
|
-
# you want to specify which datetime to select. Given the following view:
|
42
|
-
# <%%= f.label :preferred %><br />
|
43
|
-
# <%%= f.datetime_select :preferred %>
|
44
|
-
# <%%= f.label :alternative %><br />
|
45
|
-
# <%%= f.datetime_select :alternative %>
|
46
|
-
# The following steps would fill out the form:
|
47
|
-
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
48
|
-
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
49
|
-
When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
50
|
-
select_datetime(datetime, :from => datetime_label)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Use this step in conjunction with Rail's time_select helper. For example:
|
54
|
-
# When I select "2:20PM" as the time
|
55
|
-
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
56
|
-
# will convert the 2:20PM to 14:20 and then select it.
|
57
|
-
When /^I select "([^\"]*)" as the time$/ do |time|
|
58
|
-
select_time(time)
|
59
|
-
end
|
60
|
-
|
61
|
-
# Use this step when using multiple time_select helpers on a page or you want to
|
62
|
-
# specify the name of the time on the form. For example:
|
63
|
-
# When I select "7:30AM" as the "Gym" time
|
64
|
-
When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
65
|
-
select_time(time, :from => time_label)
|
66
|
-
end
|
67
|
-
|
68
|
-
# Use this step in conjunction with Rail's date_select helper. For example:
|
69
|
-
# When I select "February 20, 1981" as the date
|
70
|
-
When /^I select "([^\"]*)" as the date$/ do |date|
|
71
|
-
select_date(date)
|
72
|
-
end
|
73
|
-
|
74
|
-
# Use this step when using multiple date_select helpers on one page or
|
75
|
-
# you want to specify the name of the date on the form. For example:
|
76
|
-
# When I select "April 26, 1982" as the "Date of Birth" date
|
77
|
-
When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
78
|
-
select_date(date, :from => date_label)
|
79
|
-
end
|
80
|
-
|
81
|
-
When /^I check "([^\"]*)"$/ do |field|
|
82
|
-
check(field)
|
83
|
-
end
|
84
|
-
|
85
|
-
When /^I uncheck "([^\"]*)"$/ do |field|
|
86
|
-
uncheck(field)
|
87
|
-
end
|
88
|
-
|
89
|
-
When /^I choose "([^\"]*)"$/ do |field|
|
90
|
-
choose(field)
|
91
|
-
end
|
92
|
-
|
93
|
-
When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
94
|
-
attach_file(field, path)
|
95
|
-
end
|
96
|
-
|
97
|
-
Then /^I should see "([^\"]*)"$/ do |text|
|
98
|
-
response_body.should contain(text)
|
99
|
-
end
|
100
|
-
|
101
|
-
Then /^I should see \/([^\/]*)\/$/ do |regexp|
|
102
|
-
regexp = Regexp.new(regexp)
|
103
|
-
response_body.should contain(regexp)
|
104
|
-
end
|
105
|
-
|
106
|
-
Then /^I should not see "([^\"]*)"$/ do |text|
|
107
|
-
response_body.should_not contain(text)
|
108
|
-
end
|
109
|
-
|
110
|
-
Then /^I should not see \/([^\/]*)\/$/ do |regexp|
|
111
|
-
regexp = Regexp.new(regexp)
|
112
|
-
response_body.should_not contain(regexp)
|
113
|
-
end
|
114
|
-
|
115
|
-
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
116
|
-
field_labeled(field).value.should =~ /#{value}/
|
117
|
-
end
|
118
|
-
|
119
|
-
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
120
|
-
field_labeled(field).value.should_not =~ /#{value}/
|
121
|
-
end
|
122
|
-
|
123
|
-
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
124
|
-
field_labeled(label).should be_checked
|
125
|
-
end
|
126
|
-
|
127
|
-
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
128
|
-
field_labeled(label).should_not be_checked
|
129
|
-
end
|
130
|
-
|
131
|
-
Then /^I should be on (.+)$/ do |page_name|
|
132
|
-
URI.parse(current_url).path.should == path_to(page_name)
|
133
|
-
end
|
134
|
-
|
135
|
-
Then /^show me the page$/ do
|
136
|
-
save_and_open_page
|
137
|
-
end
|