bmabey-email_spec 0.2.1 → 0.3.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 +18 -0
- data/examples/rails_root/features/errors.feature +5 -5
- data/examples/rails_root/features/example.feature +8 -8
- data/examples/rails_root/features/step_definitions/email_steps.rb +21 -9
- data/examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/templates/email_steps.rb +21 -9
- data/lib/email_spec/helpers.rb +3 -0
- data/rails_generators/email_spec/templates/email_steps.rb +21 -9
- metadata +4 -3
data/History.txt
CHANGED
@@ -3,6 +3,24 @@
|
|
3
3
|
=== New features
|
4
4
|
=== Bufixes
|
5
5
|
|
6
|
+
== 0.3.0 2009-08-13
|
7
|
+
|
8
|
+
=== New features
|
9
|
+
* New helper #last_email_address which returns the last address used by email-spec for that scenario. (Ben Mabey)
|
10
|
+
* Steps now support third person language. (Kieran P)
|
11
|
+
* "[email] should receive ... " now supports "an" instead of just an integer. (Kieran P)
|
12
|
+
With these changes, the following is now possible:
|
13
|
+
|
14
|
+
Then "jack@example.com" should receive an email
|
15
|
+
When they open the email
|
16
|
+
Then they should see "Account has been created" in the subject
|
17
|
+
|
18
|
+
* Additional default steps (Balint Erdi)
|
19
|
+
* Then /^I should not receive any emails?$/
|
20
|
+
* When %r{^"([^"]*?)" opens? the email$} do |address|
|
21
|
+
|
22
|
+
=== Bufixes
|
23
|
+
|
6
24
|
== 0.2.1 2009-5-29
|
7
25
|
|
8
26
|
=== New Features
|
@@ -8,15 +8,15 @@ These scenarios should fail with helpful messages
|
|
8
8
|
Scenario: I fail to receive an email
|
9
9
|
Given I am at "/"
|
10
10
|
And no emails have been sent
|
11
|
-
When I fill in "Email" with "
|
11
|
+
When I fill in "Email" with "example@example.com"
|
12
12
|
And I press "Sign up"
|
13
13
|
And I should receive an email
|
14
|
-
When "
|
14
|
+
When "example@example.com" opens the email with subject "no email"
|
15
15
|
|
16
16
|
Scenario: I fail to receive an email with the expected link
|
17
17
|
Given I am at "/"
|
18
18
|
And no emails have been sent
|
19
|
-
When I fill in "Email" with "
|
19
|
+
When I fill in "Email" with "example@example.com"
|
20
20
|
And I press "Sign up"
|
21
21
|
And I should receive an email
|
22
22
|
When I open the email
|
@@ -25,7 +25,7 @@ These scenarios should fail with helpful messages
|
|
25
25
|
Scenario: I attempt to operate on an email that is not opened
|
26
26
|
Given I am at "/"
|
27
27
|
And no emails have been sent
|
28
|
-
When I fill in "Email" with "
|
28
|
+
When I fill in "Email" with "example@example.com"
|
29
29
|
And I press "Sign up"
|
30
30
|
And I should receive an email
|
31
31
|
When I follow "confirm" in the email
|
@@ -33,7 +33,7 @@ These scenarios should fail with helpful messages
|
|
33
33
|
Scenario: I attempt to check out an unopened email
|
34
34
|
Given I am at "/"
|
35
35
|
And no emails have been sent
|
36
|
-
When I fill in "Email" with "
|
36
|
+
When I fill in "Email" with "example@example.com"
|
37
37
|
And I press "Sign up"
|
38
38
|
Then I should see "confirm" in the email
|
39
39
|
And I should see "Account confirmation" in the subject
|
@@ -12,18 +12,18 @@ Scenario: A new person signs up imperatively
|
|
12
12
|
Given I am a real person wanting to sign up for an account
|
13
13
|
And I am at "/"
|
14
14
|
|
15
|
-
When I fill in "Email" with "
|
16
|
-
And I fill in "Name" with "
|
15
|
+
When I fill in "Email" with "example@example.com"
|
16
|
+
And I fill in "Name" with "example Jones"
|
17
17
|
And I press "Sign up"
|
18
18
|
|
19
|
-
Then "
|
20
|
-
And "
|
19
|
+
Then "example@example.com" should receive 1 email
|
20
|
+
And "example@example.com" should have 1 email
|
21
21
|
And "foo@bar.com" should not receive an email
|
22
22
|
|
23
|
-
When "
|
23
|
+
When "example@example.com" opens the email with subject "Account confirmation"
|
24
24
|
|
25
25
|
Then I should see "confirm" in the email
|
26
|
-
And I should see "
|
26
|
+
And I should see "example Jones" in the email
|
27
27
|
And I should see "Account confirmation" in the subject
|
28
28
|
|
29
29
|
When I follow "Click here to confirm your account!" in the email
|
@@ -34,8 +34,8 @@ Scenario: slightly more declarative, but still mostly imperative
|
|
34
34
|
Given I am a real person wanting to sign up for an account
|
35
35
|
And I'm on the signup page
|
36
36
|
|
37
|
-
When I fill in "Email" with "
|
38
|
-
And I fill in "Name" with "
|
37
|
+
When I fill in "Email" with "example@example.com"
|
38
|
+
And I fill in "Name" with "example Jones"
|
39
39
|
And I press "Sign up"
|
40
40
|
|
41
41
|
Then I should receive an email
|
@@ -15,7 +15,10 @@
|
|
15
15
|
|
16
16
|
module EmailHelpers
|
17
17
|
def current_email_address
|
18
|
-
|
18
|
+
# Replace with your a way to find your current email. e.g @current_user.email
|
19
|
+
# last_email_address will return the last email address used by email spec to find an email.
|
20
|
+
# Note that last_email_address will be reset after each Scenario.
|
21
|
+
last_email_address || "example@example.com"
|
19
22
|
end
|
20
23
|
end
|
21
24
|
World(EmailHelpers)
|
@@ -27,21 +30,26 @@ Given /^(?:a clear email queue|no emails have been sent)$/ do
|
|
27
30
|
end
|
28
31
|
|
29
32
|
# Use this step to open the most recently sent e-mail.
|
30
|
-
When /^I open the email$/ do
|
33
|
+
When /^(?:I|they) open the email$/ do
|
31
34
|
open_email(current_email_address)
|
32
35
|
end
|
33
36
|
|
34
|
-
When %r{^I follow "([^"]*?)" in the email$} do |link|
|
37
|
+
When %r{^(?:I|they) follow "([^"]*?)" in the email$} do |link|
|
35
38
|
visit_in_email(link)
|
36
39
|
end
|
37
40
|
|
38
|
-
Then /^I should receive (an|\d+) emails?$/ do |amount|
|
41
|
+
Then /^(?:I|they) should receive (an|\d+) emails?$/ do |amount|
|
39
42
|
amount = 1 if amount == "an"
|
40
43
|
unread_emails_for(current_email_address).size.should == amount.to_i
|
41
44
|
end
|
42
45
|
|
43
|
-
Then
|
44
|
-
unread_emails_for(
|
46
|
+
Then /^(?:I|they) should not receive any emails?$/ do
|
47
|
+
unread_emails_for(current_email_address).size.should == 0
|
48
|
+
end
|
49
|
+
|
50
|
+
Then %r{^"([^"]*?)" should receive (an|\d+) emails?$} do |address, amount|
|
51
|
+
amount = 1 if amount == "an"
|
52
|
+
unread_emails_for(address).size.should == amount.to_i
|
45
53
|
end
|
46
54
|
|
47
55
|
Then %r{^"([^"]*?)" should have (\d+) emails?$} do |address, n|
|
@@ -52,14 +60,18 @@ Then %r{^"([^"]*?)" should not receive an email$} do |address|
|
|
52
60
|
find_email(address).should be_nil
|
53
61
|
end
|
54
62
|
|
55
|
-
Then %r{^I should see "([^"]*?)" in the subject$} do |text|
|
63
|
+
Then %r{^(?:I|they) should see "([^"]*?)" in the subject$} do |text|
|
56
64
|
current_email.should have_subject(Regexp.new(text))
|
57
65
|
end
|
58
66
|
|
59
|
-
Then %r{^I should see "([^"]*?)" in the email$} do |text|
|
67
|
+
Then %r{^(?:I|they) should see "([^"]*?)" in the email$} do |text|
|
60
68
|
current_email.body.should =~ Regexp.new(text)
|
61
69
|
end
|
62
70
|
|
71
|
+
When %r{^"([^"]*?)" opens? the email$} do |address|
|
72
|
+
open_email(address)
|
73
|
+
end
|
74
|
+
|
63
75
|
When %r{^"([^"]*?)" opens? the email with subject "([^"]*?)"$} do |address, subject|
|
64
76
|
open_email(address, :with_subject => subject)
|
65
77
|
end
|
@@ -68,7 +80,7 @@ When %r{^"([^"]*?)" opens? the email with text "([^"]*?)"$} do |address, text|
|
|
68
80
|
open_email(address, :with_text => text)
|
69
81
|
end
|
70
82
|
|
71
|
-
When /^I click the first link in the email$/ do
|
83
|
+
When /^(?:I|they) click the first link in the email$/ do
|
72
84
|
click_first_link_in_email
|
73
85
|
end
|
74
86
|
|
@@ -15,7 +15,10 @@
|
|
15
15
|
|
16
16
|
module EmailHelpers
|
17
17
|
def current_email_address
|
18
|
-
|
18
|
+
# Replace with your a way to find your current email. e.g @current_user.email
|
19
|
+
# last_email_address will return the last email address used by email spec to find an email.
|
20
|
+
# Note that last_email_address will be reset after each Scenario.
|
21
|
+
last_email_address || "example@example.com"
|
19
22
|
end
|
20
23
|
end
|
21
24
|
World(EmailHelpers)
|
@@ -27,21 +30,26 @@ Given /^(?:a clear email queue|no emails have been sent)$/ do
|
|
27
30
|
end
|
28
31
|
|
29
32
|
# Use this step to open the most recently sent e-mail.
|
30
|
-
When /^I open the email$/ do
|
33
|
+
When /^(?:I|they) open the email$/ do
|
31
34
|
open_email(current_email_address)
|
32
35
|
end
|
33
36
|
|
34
|
-
When %r{^I follow "([^"]*?)" in the email$} do |link|
|
37
|
+
When %r{^(?:I|they) follow "([^"]*?)" in the email$} do |link|
|
35
38
|
visit_in_email(link)
|
36
39
|
end
|
37
40
|
|
38
|
-
Then /^I should receive (an|\d+) emails?$/ do |amount|
|
41
|
+
Then /^(?:I|they) should receive (an|\d+) emails?$/ do |amount|
|
39
42
|
amount = 1 if amount == "an"
|
40
43
|
unread_emails_for(current_email_address).size.should == amount.to_i
|
41
44
|
end
|
42
45
|
|
43
|
-
Then
|
44
|
-
unread_emails_for(
|
46
|
+
Then /^(?:I|they) should not receive any emails?$/ do
|
47
|
+
unread_emails_for(current_email_address).size.should == 0
|
48
|
+
end
|
49
|
+
|
50
|
+
Then %r{^"([^"]*?)" should receive (an|\d+) emails?$} do |address, amount|
|
51
|
+
amount = 1 if amount == "an"
|
52
|
+
unread_emails_for(address).size.should == amount.to_i
|
45
53
|
end
|
46
54
|
|
47
55
|
Then %r{^"([^"]*?)" should have (\d+) emails?$} do |address, n|
|
@@ -52,14 +60,18 @@ Then %r{^"([^"]*?)" should not receive an email$} do |address|
|
|
52
60
|
find_email(address).should be_nil
|
53
61
|
end
|
54
62
|
|
55
|
-
Then %r{^I should see "([^"]*?)" in the subject$} do |text|
|
63
|
+
Then %r{^(?:I|they) should see "([^"]*?)" in the subject$} do |text|
|
56
64
|
current_email.should have_subject(Regexp.new(text))
|
57
65
|
end
|
58
66
|
|
59
|
-
Then %r{^I should see "([^"]*?)" in the email$} do |text|
|
67
|
+
Then %r{^(?:I|they) should see "([^"]*?)" in the email$} do |text|
|
60
68
|
current_email.body.should =~ Regexp.new(text)
|
61
69
|
end
|
62
70
|
|
71
|
+
When %r{^"([^"]*?)" opens? the email$} do |address|
|
72
|
+
open_email(address)
|
73
|
+
end
|
74
|
+
|
63
75
|
When %r{^"([^"]*?)" opens? the email with subject "([^"]*?)"$} do |address, subject|
|
64
76
|
open_email(address, :with_subject => subject)
|
65
77
|
end
|
@@ -68,7 +80,7 @@ When %r{^"([^"]*?)" opens? the email with text "([^"]*?)"$} do |address, text|
|
|
68
80
|
open_email(address, :with_text => text)
|
69
81
|
end
|
70
82
|
|
71
|
-
When /^I click the first link in the email$/ do
|
83
|
+
When /^(?:I|they) click the first link in the email$/ do
|
72
84
|
click_first_link_in_email
|
73
85
|
end
|
74
86
|
|
data/lib/email_spec/helpers.rb
CHANGED
@@ -120,8 +120,11 @@ module EmailSpec
|
|
120
120
|
# sub correct ampersand after rails switches it (http://dev.rubyonrails.org/ticket/4002)
|
121
121
|
end
|
122
122
|
|
123
|
+
|
124
|
+
attr_reader :last_email_address
|
123
125
|
|
124
126
|
def convert_address(address)
|
127
|
+
@last_email_address = address
|
125
128
|
AddressConverter.instance.convert(address)
|
126
129
|
end
|
127
130
|
end
|
@@ -15,7 +15,10 @@
|
|
15
15
|
|
16
16
|
module EmailHelpers
|
17
17
|
def current_email_address
|
18
|
-
|
18
|
+
# Replace with your a way to find your current email. e.g @current_user.email
|
19
|
+
# last_email_address will return the last email address used by email spec to find an email.
|
20
|
+
# Note that last_email_address will be reset after each Scenario.
|
21
|
+
last_email_address || "example@example.com"
|
19
22
|
end
|
20
23
|
end
|
21
24
|
World(EmailHelpers)
|
@@ -27,21 +30,26 @@ Given /^(?:a clear email queue|no emails have been sent)$/ do
|
|
27
30
|
end
|
28
31
|
|
29
32
|
# Use this step to open the most recently sent e-mail.
|
30
|
-
When /^I open the email$/ do
|
33
|
+
When /^(?:I|they) open the email$/ do
|
31
34
|
open_email(current_email_address)
|
32
35
|
end
|
33
36
|
|
34
|
-
When %r{^I follow "([^"]*?)" in the email$} do |link|
|
37
|
+
When %r{^(?:I|they) follow "([^"]*?)" in the email$} do |link|
|
35
38
|
visit_in_email(link)
|
36
39
|
end
|
37
40
|
|
38
|
-
Then /^I should receive (an|\d+) emails?$/ do |amount|
|
41
|
+
Then /^(?:I|they) should receive (an|\d+) emails?$/ do |amount|
|
39
42
|
amount = 1 if amount == "an"
|
40
43
|
unread_emails_for(current_email_address).size.should == amount.to_i
|
41
44
|
end
|
42
45
|
|
43
|
-
Then
|
44
|
-
unread_emails_for(
|
46
|
+
Then /^(?:I|they) should not receive any emails?$/ do
|
47
|
+
unread_emails_for(current_email_address).size.should == 0
|
48
|
+
end
|
49
|
+
|
50
|
+
Then %r{^"([^"]*?)" should receive (an|\d+) emails?$} do |address, amount|
|
51
|
+
amount = 1 if amount == "an"
|
52
|
+
unread_emails_for(address).size.should == amount.to_i
|
45
53
|
end
|
46
54
|
|
47
55
|
Then %r{^"([^"]*?)" should have (\d+) emails?$} do |address, n|
|
@@ -52,14 +60,18 @@ Then %r{^"([^"]*?)" should not receive an email$} do |address|
|
|
52
60
|
find_email(address).should be_nil
|
53
61
|
end
|
54
62
|
|
55
|
-
Then %r{^I should see "([^"]*?)" in the subject$} do |text|
|
63
|
+
Then %r{^(?:I|they) should see "([^"]*?)" in the subject$} do |text|
|
56
64
|
current_email.should have_subject(Regexp.new(text))
|
57
65
|
end
|
58
66
|
|
59
|
-
Then %r{^I should see "([^"]*?)" in the email$} do |text|
|
67
|
+
Then %r{^(?:I|they) should see "([^"]*?)" in the email$} do |text|
|
60
68
|
current_email.body.should =~ Regexp.new(text)
|
61
69
|
end
|
62
70
|
|
71
|
+
When %r{^"([^"]*?)" opens? the email$} do |address|
|
72
|
+
open_email(address)
|
73
|
+
end
|
74
|
+
|
63
75
|
When %r{^"([^"]*?)" opens? the email with subject "([^"]*?)"$} do |address, subject|
|
64
76
|
open_email(address, :with_subject => subject)
|
65
77
|
end
|
@@ -68,7 +80,7 @@ When %r{^"([^"]*?)" opens? the email with text "([^"]*?)"$} do |address, text|
|
|
68
80
|
open_email(address, :with_text => text)
|
69
81
|
end
|
70
82
|
|
71
|
-
When /^I click the first link in the email$/ do
|
83
|
+
When /^(?:I|they) click the first link in the email$/ do
|
72
84
|
click_first_link_in_email
|
73
85
|
end
|
74
86
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmabey-email_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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: 2009-
|
14
|
+
date: 2009-08-13 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- spec/spec_helper.rb
|
118
118
|
has_rdoc: false
|
119
119
|
homepage: http://github.com/bmabey/email-spec/
|
120
|
+
licenses:
|
120
121
|
post_install_message:
|
121
122
|
rdoc_options:
|
122
123
|
- --charset=UTF-8
|
@@ -137,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
138
|
requirements: []
|
138
139
|
|
139
140
|
rubyforge_project: email-spec
|
140
|
-
rubygems_version: 1.
|
141
|
+
rubygems_version: 1.3.5
|
141
142
|
signing_key:
|
142
143
|
specification_version: 3
|
143
144
|
summary: Easily test email in rspec and cucumber
|