spreewald 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +9 -0
- data/lib/spreewald/email_steps.rb +5 -1
- data/lib/spreewald/web_steps.rb +3 -3
- data/lib/spreewald_support/version.rb +1 -1
- data/tests/rails-3_capybara-1/Gemfile.lock +1 -1
- data/tests/rails-3_capybara-1/app +1 -0
- data/tests/rails-3_capybara-1/config/cucumber.yml +1 -0
- data/tests/rails-3_capybara-1/config/database.yml +1 -0
- data/tests/rails-3_capybara-1/db +1 -0
- data/tests/rails-3_capybara-1/features/shared +1 -0
- data/tests/rails-3_capybara-1/features/support/paths.rb +1 -0
- data/tests/rails-3_capybara-1/features/support/selectors.rb +1 -0
- data/tests/rails-3_capybara-1/public +1 -0
- data/tests/rails-3_capybara-2/Gemfile.lock +1 -1
- data/tests/rails-3_capybara-2/Rakefile +1 -0
- data/tests/rails-3_capybara-2/app +1 -0
- data/tests/rails-3_capybara-2/config +1 -0
- data/tests/rails-3_capybara-2/config.ru +1 -0
- data/tests/rails-3_capybara-2/db +1 -0
- data/tests/rails-3_capybara-2/features +1 -0
- data/tests/rails-3_capybara-2/public +1 -0
- data/tests/rails-3_capybara-2/script +1 -0
- data/tests/rails-4_capybara-3/Gemfile.lock +1 -1
- data/tests/rails-4_capybara-3/app +1 -0
- data/tests/rails-4_capybara-3/db +1 -0
- data/tests/rails-4_capybara-3/features/development_steps.feature +1 -0
- data/tests/rails-4_capybara-3/features/email_steps.feature +1 -0
- data/tests/rails-4_capybara-3/features/overriding.feature +1 -0
- data/tests/rails-4_capybara-3/features/step_definitions/overriding_steps.rb +1 -0
- data/tests/rails-4_capybara-3/features/step_definitions/test_steps.rb +1 -0
- data/tests/rails-4_capybara-3/features/support/paths.rb +1 -0
- data/tests/rails-4_capybara-3/features/support/selectors.rb +1 -0
- data/tests/rails-4_capybara-3/features/table_steps.feature +1 -0
- data/tests/rails-4_capybara-3/features/web_steps.feature +1 -0
- data/tests/rails-4_capybara-3/public/fixture_files +1 -0
- data/tests/shared/app/models/mailer.rb +2 -2
- data/tests/shared/app/views/forms/invalid_form.html.haml +5 -5
- data/tests/shared/app/views/static_pages/visibility.html.haml +16 -0
- data/tests/shared/features/shared/web_steps.feature +40 -10
- data/tests/shared/public/fixture_files/attachment.pdf +0 -0
- metadata +31 -3
- data/tests/rails-3_capybara-1/config/cucumber.yml +0 -2
- data/tests/rails-3_capybara-1/config/database.yml +0 -7
- data/tests/rails-3_capybara-1/features/support/paths.rb +0 -16
- data/tests/rails-3_capybara-1/features/support/selectors.rb +0 -52
- data/tests/rails-3_capybara-2/Rakefile +0 -18
- data/tests/rails-3_capybara-2/config.ru +0 -4
- data/tests/rails-4_capybara-3/features/development_steps.feature +0 -8
- data/tests/rails-4_capybara-3/features/email_steps.feature +0 -216
- data/tests/rails-4_capybara-3/features/overriding.feature +0 -5
- data/tests/rails-4_capybara-3/features/step_definitions/overriding_steps.rb +0 -3
- data/tests/rails-4_capybara-3/features/step_definitions/test_steps.rb +0 -56
- data/tests/rails-4_capybara-3/features/support/paths.rb +0 -16
- data/tests/rails-4_capybara-3/features/support/selectors.rb +0 -52
- data/tests/rails-4_capybara-3/features/table_steps.feature +0 -293
- data/tests/rails-4_capybara-3/features/web_steps.feature +0 -300
@@ -1,16 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
|
3
|
-
def path_to(page_name)
|
4
|
-
case page_name
|
5
|
-
when /^"(.*)"$/
|
6
|
-
$1
|
7
|
-
|
8
|
-
else
|
9
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
10
|
-
"Now, go and add a mapping in #{__FILE__}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
World(NavigationHelpers)
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module HtmlSelectorsHelpers
|
2
|
-
# Maps a name to a selector. Used primarily by the
|
3
|
-
#
|
4
|
-
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
-
#
|
6
|
-
# step definitions in web_steps.rb
|
7
|
-
#
|
8
|
-
def selector_for(locator)
|
9
|
-
case locator
|
10
|
-
|
11
|
-
when /^a panel?$/
|
12
|
-
'.panel'
|
13
|
-
|
14
|
-
when /^a panels nested contents?$/
|
15
|
-
'.panel--nested-contents'
|
16
|
-
|
17
|
-
when /^the timeline?$/
|
18
|
-
'.timeline'
|
19
|
-
|
20
|
-
when /^the table row containing "(.+?)"$/
|
21
|
-
all('tr').detect { |tr| tr.text.include? $1 } || raise("Could not find tr containing #{$1.inspect}")
|
22
|
-
|
23
|
-
when /^a table$/
|
24
|
-
'.table'
|
25
|
-
|
26
|
-
# Add more mappings here.
|
27
|
-
# Here is an example that pulls values out of the Regexp:
|
28
|
-
#
|
29
|
-
# when /^the (notice|error|info) flash$/
|
30
|
-
# ".flash.#{$1}"
|
31
|
-
|
32
|
-
# You can also return an array to use a different selector
|
33
|
-
# type, like:
|
34
|
-
#
|
35
|
-
# when /the header/
|
36
|
-
# [:xpath, "//header"]
|
37
|
-
|
38
|
-
# This allows you to provide a quoted selector as the scope
|
39
|
-
# for "within" steps as was previously the default for the
|
40
|
-
# web steps:
|
41
|
-
when /^"(.+)"$/
|
42
|
-
$1
|
43
|
-
|
44
|
-
else
|
45
|
-
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
46
|
-
"Now, go and add a mapping in #{__FILE__}"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
World(HtmlSelectorsHelpers)
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
require 'cucumber/rake/task'
|
3
|
-
|
4
|
-
desc 'Default: Run all specs for a specific rails version.'
|
5
|
-
task :default => :features
|
6
|
-
|
7
|
-
desc 'Run all specs for rails 3.2'
|
8
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
9
|
-
feature = if ENV['SINGLE_FEATURE']
|
10
|
-
"../../shared/features/shared/#{ ENV['SINGLE_FEATURE'] }"
|
11
|
-
else
|
12
|
-
'features/shared'
|
13
|
-
end
|
14
|
-
|
15
|
-
# tell cucumber where it finds it files (subdirectories and symlinks are confusing it)
|
16
|
-
t.cucumber_opts = "--require features --require features/shared #{feature}"
|
17
|
-
end
|
18
|
-
|
@@ -1,8 +0,0 @@
|
|
1
|
-
Feature: Development steps
|
2
|
-
|
3
|
-
Scenario: /^it should work(.+?)?$/ (without a reason)
|
4
|
-
Then it should work
|
5
|
-
|
6
|
-
Scenario: /^it should work(.+?)?$/ (with a given reason)
|
7
|
-
Then it should work once the blocker described here was fulfilled. (Feature should be pending)
|
8
|
-
|
@@ -1,216 +0,0 @@
|
|
1
|
-
Feature: Test Spreewald's email steps
|
2
|
-
|
3
|
-
Scenario: /^no e?mail should have been sent$/
|
4
|
-
When I go to "/emails/do_nothing"
|
5
|
-
Then the following step should succeed:
|
6
|
-
| no email should have been sent |
|
7
|
-
|
8
|
-
When I go to "/emails/send_email"
|
9
|
-
Then the following step should fail:
|
10
|
-
| no email should have been sent |
|
11
|
-
|
12
|
-
|
13
|
-
Scenario: /^I should see "([^\"]*)" in the e?mail$/
|
14
|
-
When I go to "/emails/send_email"
|
15
|
-
Then the following step should succeed:
|
16
|
-
| I should see "Body" in the email |
|
17
|
-
But the following step should fail:
|
18
|
-
| I should see "XYZ" in the email |
|
19
|
-
|
20
|
-
|
21
|
-
Scenario: /^(an|no) e?mail should have been sent with:$/
|
22
|
-
When I go to "/emails/send_email"
|
23
|
-
|
24
|
-
# Test without body
|
25
|
-
Then the following multiline step should succeed:
|
26
|
-
"""
|
27
|
-
Then an email should have been sent with:
|
28
|
-
'''
|
29
|
-
From: from@example.com
|
30
|
-
Reply-To: reply-to@example.com
|
31
|
-
To: to@example.com
|
32
|
-
Subject: SUBJECT
|
33
|
-
'''
|
34
|
-
"""
|
35
|
-
|
36
|
-
# Test with body
|
37
|
-
Then the following multiline step should succeed:
|
38
|
-
"""
|
39
|
-
Then an email should have been sent with:
|
40
|
-
'''
|
41
|
-
From: from@example.com
|
42
|
-
Reply-To: reply-to@example.com
|
43
|
-
To: to@example.com
|
44
|
-
Subject: SUBJECT
|
45
|
-
|
46
|
-
Body
|
47
|
-
with
|
48
|
-
line
|
49
|
-
breaks
|
50
|
-
'''
|
51
|
-
"""
|
52
|
-
|
53
|
-
# Test with incorrect From header
|
54
|
-
Then the following multiline step should fail:
|
55
|
-
"""
|
56
|
-
Then an email should have been sent with:
|
57
|
-
'''
|
58
|
-
From: other-from@example.com
|
59
|
-
Reply-To: reply-to@example.com
|
60
|
-
To: to@example.com
|
61
|
-
Subject: SUBJECT
|
62
|
-
|
63
|
-
Body
|
64
|
-
with
|
65
|
-
line
|
66
|
-
breaks
|
67
|
-
'''
|
68
|
-
"""
|
69
|
-
|
70
|
-
# Test with incorrect Reply-To header
|
71
|
-
Then the following multiline step should fail:
|
72
|
-
"""
|
73
|
-
Then an email should have been sent with:
|
74
|
-
'''
|
75
|
-
From: from@example.com
|
76
|
-
Reply-To: other-reply-to@example.com
|
77
|
-
To: to@example.com
|
78
|
-
Subject: SUBJECT
|
79
|
-
|
80
|
-
Body
|
81
|
-
with
|
82
|
-
line
|
83
|
-
breaks
|
84
|
-
'''
|
85
|
-
"""
|
86
|
-
# Test with incorrect To header
|
87
|
-
Then the following multiline step should fail:
|
88
|
-
"""
|
89
|
-
Then an email should have been sent with:
|
90
|
-
'''
|
91
|
-
From: from@example.com
|
92
|
-
Reply-To: reply-to@example.com
|
93
|
-
To: other-to@example.com
|
94
|
-
Subject: SUBJECT
|
95
|
-
|
96
|
-
Body
|
97
|
-
with
|
98
|
-
line
|
99
|
-
breaks
|
100
|
-
'''
|
101
|
-
"""
|
102
|
-
|
103
|
-
# Test with incorrect Subject header
|
104
|
-
Then the following multiline step should fail:
|
105
|
-
"""
|
106
|
-
Then an email should have been sent with:
|
107
|
-
'''
|
108
|
-
From: from@example.com
|
109
|
-
Reply-To: reply-to@example.com
|
110
|
-
To: to@example.com
|
111
|
-
Subject: OTHER-SUBJECT
|
112
|
-
|
113
|
-
Body
|
114
|
-
with
|
115
|
-
line
|
116
|
-
breaks
|
117
|
-
'''
|
118
|
-
"""
|
119
|
-
|
120
|
-
# Test with incorrect body
|
121
|
-
Then the following multiline step should fail:
|
122
|
-
"""
|
123
|
-
Then an email should have been sent with:
|
124
|
-
'''
|
125
|
-
From: from@example.com
|
126
|
-
Reply-To: reply-to@example.com
|
127
|
-
To: to@example.com
|
128
|
-
Subject: SUBJECT
|
129
|
-
|
130
|
-
Other body
|
131
|
-
with
|
132
|
-
line
|
133
|
-
breaks
|
134
|
-
'''
|
135
|
-
"""
|
136
|
-
|
137
|
-
# Test body with multiple paragraphs
|
138
|
-
Then the following multiline step should fail:
|
139
|
-
"""
|
140
|
-
Then an email should have been sent with:
|
141
|
-
'''
|
142
|
-
From: from@example.com
|
143
|
-
Reply-To: reply-to@example.com
|
144
|
-
To: to@example.com
|
145
|
-
Subject: SUBJECT
|
146
|
-
|
147
|
-
Body
|
148
|
-
with
|
149
|
-
line
|
150
|
-
breaks
|
151
|
-
|
152
|
-
MORE-BODY
|
153
|
-
'''
|
154
|
-
"""
|
155
|
-
|
156
|
-
Scenario: /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/
|
157
|
-
When I go to "/emails/send_email"
|
158
|
-
|
159
|
-
# Test with correct conditions
|
160
|
-
Then the following multiline step should succeed:
|
161
|
-
"""
|
162
|
-
Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
|
163
|
-
"""
|
164
|
-
|
165
|
-
# Test with wrong conditions
|
166
|
-
Then the following multiline step should fail:
|
167
|
-
"""
|
168
|
-
Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "wrong_bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
|
169
|
-
"""
|
170
|
-
|
171
|
-
Scenario: /^that e?mail should have the following lines in the body:$/
|
172
|
-
When I go to "/emails/send_email"
|
173
|
-
|
174
|
-
# Test with correct body lines
|
175
|
-
Then the following multiline step should succeed:
|
176
|
-
"""
|
177
|
-
Then that email should have the following lines in the body:
|
178
|
-
'''
|
179
|
-
with
|
180
|
-
line
|
181
|
-
'''
|
182
|
-
"""
|
183
|
-
|
184
|
-
# Test with wrong body lines
|
185
|
-
Then the following multiline step should fail:
|
186
|
-
"""
|
187
|
-
Then that email should have the following lines in the body:
|
188
|
-
'''
|
189
|
-
wrong
|
190
|
-
line
|
191
|
-
'''
|
192
|
-
"""
|
193
|
-
|
194
|
-
|
195
|
-
Scenario: /^that e?mail should have the following( content in the)? body$/
|
196
|
-
When I go to "/emails/send_email"
|
197
|
-
|
198
|
-
# Test with correct body lines
|
199
|
-
Then the following multiline step should succeed:
|
200
|
-
"""
|
201
|
-
Then that email should have the following content in the body:
|
202
|
-
'''
|
203
|
-
with
|
204
|
-
line
|
205
|
-
'''
|
206
|
-
"""
|
207
|
-
|
208
|
-
# Test with wrong body lines
|
209
|
-
Then the following multiline step should fail:
|
210
|
-
"""
|
211
|
-
Then that email should have the following body:
|
212
|
-
'''
|
213
|
-
wrong
|
214
|
-
line
|
215
|
-
'''
|
216
|
-
"""
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'cucumber/rspec/doubles'
|
2
|
-
|
3
|
-
RSPEC_EXPECTATION_NOT_MET_ERROR = RSpec::Expectations::ExpectationNotMetError
|
4
|
-
|
5
|
-
Then /^the following steps? should (fail|succeed):$/ do |expectation, steps_table|
|
6
|
-
steps = steps_table.raw.flatten
|
7
|
-
|
8
|
-
steps.each do |step|
|
9
|
-
if expectation == 'fail'
|
10
|
-
expect { step(step) }.to raise_error(RSPEC_EXPECTATION_NOT_MET_ERROR)
|
11
|
-
|
12
|
-
else # succeed
|
13
|
-
step(step)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
When /^I run the following steps?:$/ do |steps_table|
|
20
|
-
steps = steps_table.raw.flatten
|
21
|
-
|
22
|
-
steps.each do |step|
|
23
|
-
step(step)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
Then /^the following multiline step should (fail|succeed):$/ do |expectation, multiline_step|
|
28
|
-
multiline_step = multiline_step.gsub(%{'''}, %{"""})
|
29
|
-
if expectation == 'fail'
|
30
|
-
expect { steps(multiline_step) }.to raise_error(RSPEC_EXPECTATION_NOT_MET_ERROR)
|
31
|
-
else # succeed
|
32
|
-
steps(multiline_step)
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
Then(/^a hidden string with quotes should not be visible$/) do
|
38
|
-
hidden_string = %Q{hidden '" quotes}
|
39
|
-
assert_hidden(:text => hidden_string)
|
40
|
-
end
|
41
|
-
|
42
|
-
Then(/^a visible string with quotes should be visible$/) do
|
43
|
-
visible_string = %Q{visible '" quotes}
|
44
|
-
assert_visible(:text => visible_string)
|
45
|
-
end
|
46
|
-
|
47
|
-
Then(/^'show me the page' should open the page or take a screenshot$/) do
|
48
|
-
# Projects with Capybara 1 & 2 use the launchy gem
|
49
|
-
if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "3.0")
|
50
|
-
expect(Launchy).to receive(:open)
|
51
|
-
step 'show me the page'
|
52
|
-
else
|
53
|
-
expect_any_instance_of(Capybara::Screenshot::Saver).to receive(:save)
|
54
|
-
step 'show me the page'
|
55
|
-
end
|
56
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
|
3
|
-
def path_to(page_name)
|
4
|
-
case page_name
|
5
|
-
when /^"(.*)"$/
|
6
|
-
$1
|
7
|
-
|
8
|
-
else
|
9
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
10
|
-
"Now, go and add a mapping in #{__FILE__}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
World(NavigationHelpers)
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module HtmlSelectorsHelpers
|
2
|
-
# Maps a name to a selector. Used primarily by the
|
3
|
-
#
|
4
|
-
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
-
#
|
6
|
-
# step definitions in web_steps.rb
|
7
|
-
#
|
8
|
-
def selector_for(locator)
|
9
|
-
case locator
|
10
|
-
|
11
|
-
when /^a panel?$/
|
12
|
-
'.panel'
|
13
|
-
|
14
|
-
when /^a panels nested contents?$/
|
15
|
-
'.panel--nested-contents'
|
16
|
-
|
17
|
-
when /^the timeline?$/
|
18
|
-
'.timeline'
|
19
|
-
|
20
|
-
when /^the table row containing "(.+?)"$/
|
21
|
-
all('tr').detect { |tr| tr.text.include? $1 } || raise("Could not find tr containing #{$1.inspect}")
|
22
|
-
|
23
|
-
when /^a table$/
|
24
|
-
'.table'
|
25
|
-
|
26
|
-
# Add more mappings here.
|
27
|
-
# Here is an example that pulls values out of the Regexp:
|
28
|
-
#
|
29
|
-
# when /^the (notice|error|info) flash$/
|
30
|
-
# ".flash.#{$1}"
|
31
|
-
|
32
|
-
# You can also return an array to use a different selector
|
33
|
-
# type, like:
|
34
|
-
#
|
35
|
-
# when /the header/
|
36
|
-
# [:xpath, "//header"]
|
37
|
-
|
38
|
-
# This allows you to provide a quoted selector as the scope
|
39
|
-
# for "within" steps as was previously the default for the
|
40
|
-
# web steps:
|
41
|
-
when /^"(.+)"$/
|
42
|
-
$1
|
43
|
-
|
44
|
-
else
|
45
|
-
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
46
|
-
"Now, go and add a mapping in #{__FILE__}"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
World(HtmlSelectorsHelpers)
|