mischa-email_spec 0.0.1 → 0.0.2
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
CHANGED
@@ -7,12 +7,19 @@ A collection of RSpec matchers and Cucumber steps to make testing emails go smoo
|
|
7
7
|
|
8
8
|
script/plugin install git://github.com/bmabey/email-spec.git
|
9
9
|
|
10
|
+
=== Gem Setup (may or may not work atm)
|
11
|
+
|
12
|
+
gem install mischa-email_spec
|
13
|
+
|
14
|
+
# config/environments/test.rb
|
15
|
+
config.gem 'email_spec'
|
16
|
+
|
10
17
|
=== Cucumber
|
11
18
|
|
12
19
|
To use the steps in features put the following in your env.rb:
|
13
20
|
|
14
21
|
# Make sure this require is after you require cucumber/rails/world.
|
15
|
-
require '
|
22
|
+
require 'email_spec/cucumber'
|
16
23
|
|
17
24
|
=== RSpec
|
18
25
|
|
data/Rakefile
CHANGED
@@ -1,14 +1,6 @@
|
|
1
|
-
|
2
|
-
require "rake/gempackagetask"
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
require "rake/clean"
|
5
|
-
require 'spec'
|
6
|
-
require 'spec/rake/spectask'
|
7
|
-
require File.expand_path('./lib/email_spec.rb')
|
1
|
+
['rubygems',"rake/gempackagetask",'rake/rdoctask',"rake/clean",'spec', 'spec/rake/spectask', File.expand_path('./lib/email_spec.rb')].each {|file| require file}
|
8
2
|
|
9
|
-
|
10
|
-
# Package && release
|
11
|
-
##############################################################################
|
3
|
+
# package + maintenance stuff
|
12
4
|
spec = Gem::Specification.new do |s|
|
13
5
|
s.name = "email_spec"
|
14
6
|
s.version = EmailSpec::VERSION
|
@@ -20,19 +12,10 @@ spec = Gem::Specification.new do |s|
|
|
20
12
|
s.bindir = "bin"
|
21
13
|
s.description = s.summary
|
22
14
|
s.require_path = "lib"
|
23
|
-
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"]
|
15
|
+
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["generators/**/*"]
|
24
16
|
# rdoc
|
25
17
|
s.has_rdoc = true
|
26
18
|
s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
|
27
|
-
|
28
|
-
# Dependencies
|
29
|
-
# s.add_dependency "nokogiri", ">= 1.0.6"
|
30
|
-
|
31
|
-
# s.rubyforge_project = "webrat"
|
32
|
-
end
|
33
|
-
|
34
|
-
Rake::GemPackageTask.new(spec) do |package|
|
35
|
-
package.gem_spec = spec
|
36
19
|
end
|
37
20
|
|
38
21
|
desc 'Show information about the gem.'
|
@@ -40,48 +23,27 @@ task :debug_gem do
|
|
40
23
|
puts spec.to_ruby
|
41
24
|
end
|
42
25
|
|
43
|
-
|
44
|
-
|
45
|
-
desc "Run API and Core specs"
|
46
|
-
Spec::Rake::SpecTask.new do |t|
|
47
|
-
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
48
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
task :gemspec do
|
27
|
+
system "rake debug_gem | grep -v \"(in \" > email-spec.gemspec"
|
49
28
|
end
|
50
29
|
|
51
|
-
|
52
|
-
|
53
|
-
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
54
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
55
|
-
t.rcov = true
|
56
|
-
t.rcov_opts = lambda do
|
57
|
-
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
58
|
-
end
|
30
|
+
Rake::GemPackageTask.new(spec) do |package|
|
31
|
+
package.gem_spec = spec
|
59
32
|
end
|
60
33
|
|
34
|
+
|
35
|
+
CLEAN.include ["pkg", "*.gem", "doc", "ri", "coverage", '**/.*.sw?', '*.gem', '.config', '**/.DS_Store', '**/*.class', '**/*.jar', '**/.*.swp' ]
|
36
|
+
|
61
37
|
desc 'Install the package as a gem.'
|
62
38
|
task :install_gem => [:clean, :package] do
|
63
39
|
gem = Dir['pkg/*.gem'].first
|
64
40
|
sh "sudo gem install --local #{gem}"
|
65
41
|
end
|
66
42
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
desc "Delete generated RDoc"
|
72
|
-
task :clobber_docs do
|
73
|
-
FileUtils.rm_rf("doc")
|
74
|
-
end
|
75
|
-
|
76
|
-
desc "Generate RDoc"
|
77
|
-
task :docs => :clobber_docs do
|
78
|
-
system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'"
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
task :test_features do
|
83
|
-
puts "hi"
|
43
|
+
# Testing
|
44
|
+
task :features do
|
45
|
+
system("cd spec/rails_root; rake features; cd ../..")
|
84
46
|
end
|
85
47
|
|
86
|
-
task :default => :
|
48
|
+
task :default => :features
|
87
49
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This generator adds email steps to the step definitions directory
|
2
|
+
class EmailSpecGenerator < Rails::Generator::Base
|
3
|
+
#DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
# Config::CONFIG['ruby_install_name'])
|
5
|
+
def manifest
|
6
|
+
record do |m|
|
7
|
+
m.directory 'features/step_definitions'
|
8
|
+
m.file 'email_steps.rb', 'features/step_definitions/email_steps.rb'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def banner
|
15
|
+
"Usage: #{$0} email_spec"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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
|
47
|
+
|
data/lib/email_spec.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = '0.0.
|
1
|
+
module EmailSpec
|
2
|
+
VERSION = '0.0.2'
|
3
3
|
end
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Mabrey
|
@@ -31,11 +31,15 @@ files:
|
|
31
31
|
- README.rdoc
|
32
32
|
- Rakefile
|
33
33
|
- lib/email_spec
|
34
|
-
- lib/email_spec/
|
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
37
|
- lib/email_spec/email_spec_steps.rb
|
38
38
|
- lib/email_spec.rb
|
39
|
+
- generators/email_spec
|
40
|
+
- generators/email_spec/email_spec_generator.rb
|
41
|
+
- generators/email_spec/templates
|
42
|
+
- generators/email_spec/templates/email_steps.rb
|
39
43
|
has_rdoc: true
|
40
44
|
homepage: http://github.com/bmabey/email-spec/
|
41
45
|
post_install_message:
|