bmabey-email_spec 0.3.0 → 0.3.1

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.
Files changed (26) hide show
  1. data/History.txt +12 -2
  2. data/Rakefile +16 -1
  3. data/examples/rails_root/app/controllers/{application.rb → application_controller.rb} +0 -0
  4. data/examples/rails_root/app/models/user_mailer.rb +1 -2
  5. data/examples/rails_root/config/boot.rb +1 -0
  6. data/examples/rails_root/config/environment.rb +2 -2
  7. data/examples/rails_root/config/environments/test.rb +6 -10
  8. data/examples/rails_root/features/errors.feature +31 -41
  9. data/examples/rails_root/features/example.feature +44 -41
  10. data/examples/rails_root/features/step_definitions/user_steps.rb +11 -8
  11. data/examples/rails_root/features/step_definitions/webrat_steps.rb +72 -39
  12. data/examples/rails_root/features/support/env.rb +15 -4
  13. data/examples/rails_root/features/support/paths.rb +21 -0
  14. data/examples/rails_root/script/cucumber +6 -4
  15. data/examples/rails_root/spec/models/user_mailer_spec.rb +3 -3
  16. data/examples/rails_root/spec/spec_helper.rb +1 -1
  17. data/lib/email_spec/deliveries.rb +0 -2
  18. data/lib/email_spec/helpers.rb +48 -31
  19. data/rails_generators/email_spec/templates/email_steps.rb +66 -30
  20. metadata +72 -83
  21. data/examples/rails_root/cucumber.yml +0 -1
  22. data/examples/rails_root/features/step_definitions/email_steps.rb +0 -86
  23. data/examples/rails_root/stories/all.rb +0 -4
  24. data/examples/rails_root/stories/helper.rb +0 -3
  25. data/examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/email_spec_generator.rb +0 -17
  26. data/examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/templates/email_steps.rb +0 -86
@@ -1 +0,0 @@
1
- default: features/example.feature
@@ -1,86 +0,0 @@
1
- #Commonly used email steps
2
- #
3
- # To add your own steps make a custom_email_steps.rb
4
- # The provided methods are:
5
- #
6
- # reset_mailer
7
- # open_last_email
8
- # visit_in_email
9
- # unread_emails_for
10
- # mailbox_for
11
- # current_email
12
- # open_email
13
- # read_emails_for
14
- # find_email
15
-
16
- module EmailHelpers
17
- def current_email_address
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"
22
- end
23
- end
24
- World(EmailHelpers)
25
-
26
- # Use this step to reset the e-mail queue within a scenario.
27
- # This is done automatically before each scenario.
28
- Given /^(?:a clear email queue|no emails have been sent)$/ do
29
- reset_mailer
30
- end
31
-
32
- # Use this step to open the most recently sent e-mail.
33
- When /^(?:I|they) open the email$/ do
34
- open_email(current_email_address)
35
- end
36
-
37
- When %r{^(?:I|they) follow "([^"]*?)" in the email$} do |link|
38
- visit_in_email(link)
39
- end
40
-
41
- Then /^(?:I|they) should receive (an|\d+) emails?$/ do |amount|
42
- amount = 1 if amount == "an"
43
- unread_emails_for(current_email_address).size.should == amount.to_i
44
- end
45
-
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
53
- end
54
-
55
- Then %r{^"([^"]*?)" should have (\d+) emails?$} do |address, n|
56
- mailbox_for(address).size.should == n.to_i
57
- end
58
-
59
- Then %r{^"([^"]*?)" should not receive an email$} do |address|
60
- find_email(address).should be_nil
61
- end
62
-
63
- Then %r{^(?:I|they) should see "([^"]*?)" in the subject$} do |text|
64
- current_email.should have_subject(Regexp.new(text))
65
- end
66
-
67
- Then %r{^(?:I|they) should see "([^"]*?)" in the email$} do |text|
68
- current_email.body.should =~ Regexp.new(text)
69
- end
70
-
71
- When %r{^"([^"]*?)" opens? the email$} do |address|
72
- open_email(address)
73
- end
74
-
75
- When %r{^"([^"]*?)" opens? the email with subject "([^"]*?)"$} do |address, subject|
76
- open_email(address, :with_subject => subject)
77
- end
78
-
79
- When %r{^"([^"]*?)" opens? the email with text "([^"]*?)"$} do |address, text|
80
- open_email(address, :with_text => text)
81
- end
82
-
83
- When /^(?:I|they) click the first link in the email$/ do
84
- click_first_link_in_email
85
- end
86
-
@@ -1,4 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
3
- require file
4
- end
@@ -1,3 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
- require 'spec/rails/story_adapter'
@@ -1,17 +0,0 @@
1
- # This generator adds email steps to the step definitions directory
2
- generator_base = defined?(Rails) ? Rails::Generator::Base : RubiGen::Base
3
- class EmailSpecGenerator < generator_base
4
- def manifest
5
- record do |m|
6
- m.directory 'features/step_definitions'
7
- m.file 'email_steps.rb', 'features/step_definitions/email_steps.rb'
8
- end
9
- end
10
-
11
- protected
12
-
13
- def banner
14
- "Usage: #{$0} email_spec"
15
- end
16
-
17
- end
@@ -1,86 +0,0 @@
1
- #Commonly used email steps
2
- #
3
- # To add your own steps make a custom_email_steps.rb
4
- # The provided methods are:
5
- #
6
- # reset_mailer
7
- # open_last_email
8
- # visit_in_email
9
- # unread_emails_for
10
- # mailbox_for
11
- # current_email
12
- # open_email
13
- # read_emails_for
14
- # find_email
15
-
16
- module EmailHelpers
17
- def current_email_address
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"
22
- end
23
- end
24
- World(EmailHelpers)
25
-
26
- # Use this step to reset the e-mail queue within a scenario.
27
- # This is done automatically before each scenario.
28
- Given /^(?:a clear email queue|no emails have been sent)$/ do
29
- reset_mailer
30
- end
31
-
32
- # Use this step to open the most recently sent e-mail.
33
- When /^(?:I|they) open the email$/ do
34
- open_email(current_email_address)
35
- end
36
-
37
- When %r{^(?:I|they) follow "([^"]*?)" in the email$} do |link|
38
- visit_in_email(link)
39
- end
40
-
41
- Then /^(?:I|they) should receive (an|\d+) emails?$/ do |amount|
42
- amount = 1 if amount == "an"
43
- unread_emails_for(current_email_address).size.should == amount.to_i
44
- end
45
-
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
53
- end
54
-
55
- Then %r{^"([^"]*?)" should have (\d+) emails?$} do |address, n|
56
- mailbox_for(address).size.should == n.to_i
57
- end
58
-
59
- Then %r{^"([^"]*?)" should not receive an email$} do |address|
60
- find_email(address).should be_nil
61
- end
62
-
63
- Then %r{^(?:I|they) should see "([^"]*?)" in the subject$} do |text|
64
- current_email.should have_subject(Regexp.new(text))
65
- end
66
-
67
- Then %r{^(?:I|they) should see "([^"]*?)" in the email$} do |text|
68
- current_email.body.should =~ Regexp.new(text)
69
- end
70
-
71
- When %r{^"([^"]*?)" opens? the email$} do |address|
72
- open_email(address)
73
- end
74
-
75
- When %r{^"([^"]*?)" opens? the email with subject "([^"]*?)"$} do |address, subject|
76
- open_email(address, :with_subject => subject)
77
- end
78
-
79
- When %r{^"([^"]*?)" opens? the email with text "([^"]*?)"$} do |address, text|
80
- open_email(address, :with_text => text)
81
- end
82
-
83
- When /^(?:I|they) click the first link in the email$/ do
84
- click_first_link_in_email
85
- end
86
-