mischa-email_spec 0.0.3 → 0.0.4
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/README.rdoc +11 -10
- data/Rakefile +1 -1
- data/generators/email_spec/templates/email_steps.rb +36 -12
- data/lib/email_spec/email_spec_helpers.rb +54 -35
- data/lib/email_spec.rb +1 -1
- data/spec/email_spec_helpers_spec.rb +28 -0
- data/spec/rails_root/Rakefile +10 -0
- data/spec/rails_root/app/controllers/application.rb +15 -0
- data/spec/rails_root/app/controllers/welcome_controller.rb +9 -0
- data/spec/rails_root/app/helpers/application_helper.rb +3 -0
- data/spec/rails_root/app/helpers/welcome_helper.rb +2 -0
- data/spec/rails_root/app/models/user_mailer.rb +12 -0
- data/spec/rails_root/app/views/user_mailer/signup.erb +3 -0
- data/spec/rails_root/app/views/welcome/confirm.html.erb +1 -0
- data/spec/rails_root/app/views/welcome/index.html.erb +8 -0
- data/spec/rails_root/app/views/welcome/signup.html.erb +1 -0
- data/spec/rails_root/config/boot.rb +109 -0
- data/spec/rails_root/config/database.yml +22 -0
- data/spec/rails_root/config/environment.rb +22 -0
- data/spec/rails_root/config/environments/development.rb +17 -0
- data/spec/rails_root/config/environments/production.rb +24 -0
- data/spec/rails_root/config/environments/test.rb +29 -0
- data/spec/rails_root/config/initializers/inflections.rb +10 -0
- data/spec/rails_root/config/initializers/mime_types.rb +5 -0
- data/spec/rails_root/config/initializers/new_rails_defaults.rb +17 -0
- data/spec/rails_root/config/routes.rb +43 -0
- data/spec/rails_root/db/schema.rb +14 -0
- data/spec/rails_root/doc/README_FOR_APP +5 -0
- data/spec/rails_root/features/errors.feature +42 -0
- data/spec/rails_root/features/example.feature +34 -0
- data/spec/rails_root/features/step_definitions/email_steps.rb +68 -0
- data/spec/rails_root/features/step_definitions/webrat_steps.rb +100 -0
- data/spec/rails_root/features/support/env.rb +14 -0
- data/spec/rails_root/lib/tasks/cucumber.rake +7 -0
- data/spec/rails_root/lib/tasks/rspec.rake +153 -0
- data/spec/rails_root/public/404.html +30 -0
- data/spec/rails_root/public/422.html +30 -0
- data/spec/rails_root/public/500.html +33 -0
- data/spec/rails_root/public/dispatch.rb +10 -0
- data/spec/rails_root/public/favicon.ico +0 -0
- data/spec/rails_root/public/images/rails.png +0 -0
- data/spec/rails_root/public/javascripts/application.js +2 -0
- data/spec/rails_root/public/javascripts/controls.js +963 -0
- data/spec/rails_root/public/javascripts/dragdrop.js +973 -0
- data/spec/rails_root/public/javascripts/effects.js +1128 -0
- data/spec/rails_root/public/javascripts/prototype.js +4320 -0
- data/spec/rails_root/public/robots.txt +5 -0
- data/spec/rails_root/script/about +4 -0
- data/spec/rails_root/script/autospec +5 -0
- data/spec/rails_root/script/console +3 -0
- data/spec/rails_root/script/cucumber +7 -0
- data/spec/rails_root/script/dbconsole +3 -0
- data/spec/rails_root/script/destroy +3 -0
- data/spec/rails_root/script/generate +3 -0
- data/spec/rails_root/script/performance/benchmarker +3 -0
- data/spec/rails_root/script/performance/profiler +3 -0
- data/spec/rails_root/script/performance/request +3 -0
- data/spec/rails_root/script/plugin +3 -0
- data/spec/rails_root/script/process/inspector +3 -0
- data/spec/rails_root/script/process/reaper +3 -0
- data/spec/rails_root/script/process/spawner +3 -0
- data/spec/rails_root/script/runner +3 -0
- data/spec/rails_root/script/server +3 -0
- data/spec/rails_root/script/spec +5 -0
- data/spec/rails_root/script/spec_server +116 -0
- data/spec/rails_root/spec/rcov.opts +2 -0
- data/spec/rails_root/spec/spec.opts +4 -0
- data/spec/rails_root/spec/spec_helper.rb +47 -0
- data/spec/rails_root/vendor/plugins/email_spec/generators/email_spec/email_spec_generator.rb +16 -0
- data/spec/rails_root/vendor/plugins/email_spec/generators/email_spec/templates/email_steps.rb +68 -0
- metadata +108 -2
- data/lib/email_spec/email_spec_steps.rb +0 -46
@@ -0,0 +1,5 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
ENV['RSPEC'] = 'true' # allows autotest to discover rspec
|
3
|
+
ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
|
4
|
+
system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
|
5
|
+
$stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
|
3
|
+
require 'rubygems'
|
4
|
+
require 'drb/drb'
|
5
|
+
require 'rbconfig'
|
6
|
+
require 'spec'
|
7
|
+
require 'optparse'
|
8
|
+
|
9
|
+
# This is based on Florian Weber's TDDMate
|
10
|
+
module Spec
|
11
|
+
module Runner
|
12
|
+
class RailsSpecServer
|
13
|
+
def run(argv, stderr, stdout)
|
14
|
+
$stdout = stdout
|
15
|
+
$stderr = stderr
|
16
|
+
|
17
|
+
base = ActiveRecord::Base
|
18
|
+
def base.clear_reloadable_connections!
|
19
|
+
active_connections.each do |name, conn|
|
20
|
+
if conn.requires_reloading?
|
21
|
+
conn.disconnect!
|
22
|
+
active_connections.delete(name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if ActionController.const_defined?(:Dispatcher)
|
28
|
+
dispatcher = ::ActionController::Dispatcher.new($stdout)
|
29
|
+
dispatcher.cleanup_application
|
30
|
+
elsif ::Dispatcher.respond_to?(:reset_application!)
|
31
|
+
::Dispatcher.reset_application!
|
32
|
+
else
|
33
|
+
raise "Application reloading failed"
|
34
|
+
end
|
35
|
+
if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
|
36
|
+
Fixtures.reset_cache
|
37
|
+
end
|
38
|
+
|
39
|
+
::Dependencies.mechanism = :load
|
40
|
+
require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
|
41
|
+
load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
|
42
|
+
|
43
|
+
if in_memory_database?
|
44
|
+
load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
|
45
|
+
ActiveRecord::Migrator.up('db/migrate') # use migrations
|
46
|
+
end
|
47
|
+
|
48
|
+
::Spec::Runner::CommandLine.run(
|
49
|
+
::Spec::Runner::OptionParser.parse(
|
50
|
+
argv,
|
51
|
+
$stderr,
|
52
|
+
$stdout
|
53
|
+
)
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def in_memory_database?
|
58
|
+
ENV["RAILS_ENV"] == "test" and
|
59
|
+
::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
|
60
|
+
::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
puts "Loading Rails environment"
|
66
|
+
|
67
|
+
ENV["RAILS_ENV"] = "test"
|
68
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
69
|
+
require 'dispatcher'
|
70
|
+
|
71
|
+
def restart_test_server
|
72
|
+
puts "restarting"
|
73
|
+
config = ::Config::CONFIG
|
74
|
+
ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
|
75
|
+
command_line = [ruby, $0, ARGV].flatten.join(' ')
|
76
|
+
exec(command_line)
|
77
|
+
end
|
78
|
+
|
79
|
+
def daemonize(pid_file = nil)
|
80
|
+
return yield if $DEBUG
|
81
|
+
pid = Process.fork{
|
82
|
+
Process.setsid
|
83
|
+
Dir.chdir(RAILS_ROOT)
|
84
|
+
trap("SIGINT"){ exit! 0 }
|
85
|
+
trap("SIGTERM"){ exit! 0 }
|
86
|
+
trap("SIGHUP"){ restart_test_server }
|
87
|
+
File.open("/dev/null"){|f|
|
88
|
+
STDERR.reopen f
|
89
|
+
STDIN.reopen f
|
90
|
+
STDOUT.reopen f
|
91
|
+
}
|
92
|
+
yield
|
93
|
+
}
|
94
|
+
puts "spec_server launched. (PID: %d)" % pid
|
95
|
+
File.open(pid_file,"w"){|f| f.puts pid } if pid_file
|
96
|
+
exit! 0
|
97
|
+
end
|
98
|
+
|
99
|
+
options = Hash.new
|
100
|
+
opts = OptionParser.new
|
101
|
+
opts.on("-d", "--daemon"){|v| options[:daemon] = true }
|
102
|
+
opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
|
103
|
+
opts.parse!(ARGV)
|
104
|
+
|
105
|
+
puts "Ready"
|
106
|
+
exec_server = lambda {
|
107
|
+
trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
|
108
|
+
DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new)
|
109
|
+
DRb.thread.join
|
110
|
+
}
|
111
|
+
|
112
|
+
if options[:daemon]
|
113
|
+
daemonize(options[:pid], &exec_server)
|
114
|
+
else
|
115
|
+
exec_server.call
|
116
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
|
+
# from the project root directory.
|
3
|
+
ENV["RAILS_ENV"] = "test"
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
5
|
+
require 'spec'
|
6
|
+
require 'spec/rails'
|
7
|
+
|
8
|
+
Spec::Runner.configure do |config|
|
9
|
+
# If you're not using ActiveRecord you should remove these
|
10
|
+
# lines, delete config/database.yml and disable :active_record
|
11
|
+
# in your config/boot.rb
|
12
|
+
config.use_transactional_fixtures = true
|
13
|
+
config.use_instantiated_fixtures = false
|
14
|
+
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
|
15
|
+
|
16
|
+
# == Fixtures
|
17
|
+
#
|
18
|
+
# You can declare fixtures for each example_group like this:
|
19
|
+
# describe "...." do
|
20
|
+
# fixtures :table_a, :table_b
|
21
|
+
#
|
22
|
+
# Alternatively, if you prefer to declare them only once, you can
|
23
|
+
# do so right here. Just uncomment the next line and replace the fixture
|
24
|
+
# names with your fixtures.
|
25
|
+
#
|
26
|
+
# config.global_fixtures = :table_a, :table_b
|
27
|
+
#
|
28
|
+
# If you declare global fixtures, be aware that they will be declared
|
29
|
+
# for all of your examples, even those that don't use them.
|
30
|
+
#
|
31
|
+
# You can also declare which fixtures to use (for example fixtures for test/fixtures):
|
32
|
+
#
|
33
|
+
# config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
|
34
|
+
#
|
35
|
+
# == Mock Framework
|
36
|
+
#
|
37
|
+
# RSpec uses it's own mocking framework by default. If you prefer to
|
38
|
+
# use mocha, flexmock or RR, uncomment the appropriate line:
|
39
|
+
#
|
40
|
+
# config.mock_with :mocha
|
41
|
+
# config.mock_with :flexmock
|
42
|
+
# config.mock_with :rr
|
43
|
+
#
|
44
|
+
# == Notes
|
45
|
+
#
|
46
|
+
# For more information take a look at Spec::Example::Configuration and Spec::Runner
|
47
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This generator adds email steps to the step definitions directory
|
2
|
+
class EmailSpecGenerator < Rails::Generator::Base
|
3
|
+
def manifest
|
4
|
+
record do |m|
|
5
|
+
m.directory 'features/step_definitions'
|
6
|
+
m.file 'email_steps.rb', 'features/step_definitions/email_steps.rb'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def banner
|
13
|
+
"Usage: #{$0} email_spec"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,68 @@
|
|
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
|
+
|
17
|
+
def current_email_address
|
18
|
+
"quentin@example.com" # Replace with your a way to find your current_email. e.g current_user.email
|
19
|
+
end
|
20
|
+
# Use this step to reset the e-mail queue within a scenario.
|
21
|
+
# This is done automatically before each scenario.
|
22
|
+
Given /^no emails have been sent$/ do
|
23
|
+
reset_mailer
|
24
|
+
end
|
25
|
+
|
26
|
+
# Use this step to open the most recently sent e-mail.
|
27
|
+
When /^I open the email$/ do
|
28
|
+
open_email(current_email_address)
|
29
|
+
end
|
30
|
+
|
31
|
+
When /^I follow "(.*)" in the email$/ do |link|
|
32
|
+
visit_in_email(link)
|
33
|
+
end
|
34
|
+
|
35
|
+
Then /^I should receive (.*) emails?$/ do |amount|
|
36
|
+
amount = 1 if amount == "an"
|
37
|
+
unread_emails_for(current_email_address).size.should == amount
|
38
|
+
end
|
39
|
+
|
40
|
+
Then /^"([^']*?)" should receive (\d+) emails?$/ do |address, n|
|
41
|
+
unread_emails_for(address).size.should == n.to_i
|
42
|
+
end
|
43
|
+
|
44
|
+
Then /^"([^']*?)" should have (\d+) emails?$/ do |address, n|
|
45
|
+
mailbox_for(address).size.should == n.to_i
|
46
|
+
end
|
47
|
+
|
48
|
+
Then /^"([^']*?)" should not receive an email$/ do |address|
|
49
|
+
find_email(address).should be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
Then /^I should see "(.*)" in the subject$/ do |text|
|
53
|
+
current_email.subject.should =~ Regexp.new(text)
|
54
|
+
end
|
55
|
+
|
56
|
+
Then /^I should see "(.*)" in the email$/ do |text|
|
57
|
+
current_email.body.should =~ Regexp.new(text)
|
58
|
+
end
|
59
|
+
|
60
|
+
When %r{^"([^']*?)" opens? the email with subject "([^']*?)"$} do |address, subject|
|
61
|
+
open_email(address, :with_subject => subject)
|
62
|
+
end
|
63
|
+
|
64
|
+
When %r{^"([^']*?)" opens? the email with text "([^']*?)"$} do |address, text|
|
65
|
+
open_email(address, :with_text => text)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mischa-email_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Mabrey
|
@@ -34,12 +34,118 @@ files:
|
|
34
34
|
- lib/email_spec/cucumber.rb
|
35
35
|
- lib/email_spec/email_spec_helpers.rb
|
36
36
|
- lib/email_spec/email_spec_matchers.rb
|
37
|
-
- lib/email_spec/email_spec_steps.rb
|
38
37
|
- lib/email_spec.rb
|
39
38
|
- generators/email_spec
|
40
39
|
- generators/email_spec/email_spec_generator.rb
|
41
40
|
- generators/email_spec/templates
|
42
41
|
- generators/email_spec/templates/email_steps.rb
|
42
|
+
- spec/email_spec_helpers_spec.rb
|
43
|
+
- spec/rails_root
|
44
|
+
- spec/rails_root/app
|
45
|
+
- spec/rails_root/app/controllers
|
46
|
+
- spec/rails_root/app/controllers/application.rb
|
47
|
+
- spec/rails_root/app/controllers/welcome_controller.rb
|
48
|
+
- spec/rails_root/app/helpers
|
49
|
+
- spec/rails_root/app/helpers/application_helper.rb
|
50
|
+
- spec/rails_root/app/helpers/welcome_helper.rb
|
51
|
+
- spec/rails_root/app/models
|
52
|
+
- spec/rails_root/app/models/user_mailer.rb
|
53
|
+
- spec/rails_root/app/views
|
54
|
+
- spec/rails_root/app/views/user_mailer
|
55
|
+
- spec/rails_root/app/views/user_mailer/signup.erb
|
56
|
+
- spec/rails_root/app/views/welcome
|
57
|
+
- spec/rails_root/app/views/welcome/confirm.html.erb
|
58
|
+
- spec/rails_root/app/views/welcome/index.html.erb
|
59
|
+
- spec/rails_root/app/views/welcome/signup.html.erb
|
60
|
+
- spec/rails_root/config
|
61
|
+
- spec/rails_root/config/boot.rb
|
62
|
+
- spec/rails_root/config/database.yml
|
63
|
+
- spec/rails_root/config/environment.rb
|
64
|
+
- spec/rails_root/config/environments
|
65
|
+
- spec/rails_root/config/environments/development.rb
|
66
|
+
- spec/rails_root/config/environments/production.rb
|
67
|
+
- spec/rails_root/config/environments/test.rb
|
68
|
+
- spec/rails_root/config/initializers
|
69
|
+
- spec/rails_root/config/initializers/inflections.rb
|
70
|
+
- spec/rails_root/config/initializers/mime_types.rb
|
71
|
+
- spec/rails_root/config/initializers/new_rails_defaults.rb
|
72
|
+
- spec/rails_root/config/routes.rb
|
73
|
+
- spec/rails_root/db
|
74
|
+
- spec/rails_root/db/development.sqlite3
|
75
|
+
- spec/rails_root/db/schema.rb
|
76
|
+
- spec/rails_root/db/test.sqlite3
|
77
|
+
- spec/rails_root/doc
|
78
|
+
- spec/rails_root/doc/README_FOR_APP
|
79
|
+
- spec/rails_root/features
|
80
|
+
- spec/rails_root/features/errors.feature
|
81
|
+
- spec/rails_root/features/example.feature
|
82
|
+
- spec/rails_root/features/step_definitions
|
83
|
+
- spec/rails_root/features/step_definitions/email_steps.rb
|
84
|
+
- spec/rails_root/features/step_definitions/webrat_steps.rb
|
85
|
+
- spec/rails_root/features/support
|
86
|
+
- spec/rails_root/features/support/env.rb
|
87
|
+
- spec/rails_root/lib
|
88
|
+
- spec/rails_root/lib/tasks
|
89
|
+
- spec/rails_root/lib/tasks/cucumber.rake
|
90
|
+
- spec/rails_root/lib/tasks/rspec.rake
|
91
|
+
- spec/rails_root/log
|
92
|
+
- spec/rails_root/log/development.log
|
93
|
+
- spec/rails_root/log/test.log
|
94
|
+
- spec/rails_root/public
|
95
|
+
- spec/rails_root/public/404.html
|
96
|
+
- spec/rails_root/public/422.html
|
97
|
+
- spec/rails_root/public/500.html
|
98
|
+
- spec/rails_root/public/dispatch.rb
|
99
|
+
- spec/rails_root/public/favicon.ico
|
100
|
+
- spec/rails_root/public/images
|
101
|
+
- spec/rails_root/public/images/rails.png
|
102
|
+
- spec/rails_root/public/javascripts
|
103
|
+
- spec/rails_root/public/javascripts/application.js
|
104
|
+
- spec/rails_root/public/javascripts/controls.js
|
105
|
+
- spec/rails_root/public/javascripts/dragdrop.js
|
106
|
+
- spec/rails_root/public/javascripts/effects.js
|
107
|
+
- spec/rails_root/public/javascripts/prototype.js
|
108
|
+
- spec/rails_root/public/robots.txt
|
109
|
+
- spec/rails_root/public/stylesheets
|
110
|
+
- spec/rails_root/Rakefile
|
111
|
+
- spec/rails_root/script
|
112
|
+
- spec/rails_root/script/about
|
113
|
+
- spec/rails_root/script/autospec
|
114
|
+
- spec/rails_root/script/console
|
115
|
+
- spec/rails_root/script/cucumber
|
116
|
+
- spec/rails_root/script/dbconsole
|
117
|
+
- spec/rails_root/script/destroy
|
118
|
+
- spec/rails_root/script/generate
|
119
|
+
- spec/rails_root/script/performance
|
120
|
+
- spec/rails_root/script/performance/benchmarker
|
121
|
+
- spec/rails_root/script/performance/profiler
|
122
|
+
- spec/rails_root/script/performance/request
|
123
|
+
- spec/rails_root/script/plugin
|
124
|
+
- spec/rails_root/script/process
|
125
|
+
- spec/rails_root/script/process/inspector
|
126
|
+
- spec/rails_root/script/process/reaper
|
127
|
+
- spec/rails_root/script/process/spawner
|
128
|
+
- spec/rails_root/script/runner
|
129
|
+
- spec/rails_root/script/server
|
130
|
+
- spec/rails_root/script/spec
|
131
|
+
- spec/rails_root/script/spec_server
|
132
|
+
- spec/rails_root/spec
|
133
|
+
- spec/rails_root/spec/rcov.opts
|
134
|
+
- spec/rails_root/spec/spec.opts
|
135
|
+
- spec/rails_root/spec/spec_helper.rb
|
136
|
+
- spec/rails_root/tmp
|
137
|
+
- spec/rails_root/tmp/cache
|
138
|
+
- spec/rails_root/tmp/pids
|
139
|
+
- spec/rails_root/tmp/sessions
|
140
|
+
- spec/rails_root/tmp/sockets
|
141
|
+
- spec/rails_root/vendor
|
142
|
+
- spec/rails_root/vendor/plugins
|
143
|
+
- spec/rails_root/vendor/plugins/email_spec
|
144
|
+
- spec/rails_root/vendor/plugins/email_spec/generators
|
145
|
+
- spec/rails_root/vendor/plugins/email_spec/generators/email_spec
|
146
|
+
- spec/rails_root/vendor/plugins/email_spec/generators/email_spec/email_spec_generator.rb
|
147
|
+
- spec/rails_root/vendor/plugins/email_spec/generators/email_spec/templates
|
148
|
+
- spec/rails_root/vendor/plugins/email_spec/generators/email_spec/templates/email_steps.rb
|
43
149
|
has_rdoc: true
|
44
150
|
homepage: http://github.com/bmabey/email-spec/
|
45
151
|
post_install_message:
|
@@ -1,46 +0,0 @@
|
|
1
|
-
Given /^(?:a clear email queue|no emails have been sent)$/ do
|
2
|
-
reset_mailer
|
3
|
-
end
|
4
|
-
|
5
|
-
# Action
|
6
|
-
#
|
7
|
-
When /^I open the email$/ do
|
8
|
-
open_last_email.should_not be_nil
|
9
|
-
end
|
10
|
-
|
11
|
-
When /^I follow "(.*)" in the email$/ do |link_text|
|
12
|
-
current_email.should_not be_nil
|
13
|
-
link = parse_email_for_link(current_email, link_text)
|
14
|
-
visit(link)
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I click "(.*)" in the email$/ do |link_text|
|
18
|
-
current_email.should_not be_nil
|
19
|
-
link = parse_email_for_link(current_email, link_text)
|
20
|
-
visit(link)
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
# Verification
|
25
|
-
Then /^"([^']*?)" should receive (\d+) emails?$/ do |email, n|
|
26
|
-
unread_emails_for(email).size.should == n.to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
Then /^"([^']*?)" should have (\d+) emails?$/ do |email, n|
|
30
|
-
mailbox_for(email).size.should == n.to_i
|
31
|
-
end
|
32
|
-
|
33
|
-
Then /^"([^']*?)" should not receive an email$/ do |email|
|
34
|
-
open_email(email).should be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
Then /^I should see "(.*)" in the subject$/ do |text|
|
38
|
-
raise ArgumentError, "To check the subject, you must first open an e-mail" if current_email.nil?
|
39
|
-
current_email.should_not be_nil
|
40
|
-
current_email.subject.should =~ Regexp.new(text)
|
41
|
-
end
|
42
|
-
|
43
|
-
Then /^I should see "(.*)" in the email$/ do |text|
|
44
|
-
current_email.should_not be_nil
|
45
|
-
current_email.body.should =~ Regexp.new(text)
|
46
|
-
end
|