opsb-email_spec 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/History.txt +199 -0
  2. data/MIT-LICENSE.txt +19 -0
  3. data/README.rdoc +135 -0
  4. data/Rakefile +77 -0
  5. data/examples/rails_root/Rakefile +13 -0
  6. data/examples/rails_root/app/controllers/application_controller.rb +15 -0
  7. data/examples/rails_root/app/controllers/welcome_controller.rb +16 -0
  8. data/examples/rails_root/app/helpers/application_helper.rb +3 -0
  9. data/examples/rails_root/app/helpers/welcome_helper.rb +2 -0
  10. data/examples/rails_root/app/models/user.rb +2 -0
  11. data/examples/rails_root/app/models/user_mailer.rb +39 -0
  12. data/examples/rails_root/app/views/user_mailer/attachments.erb +6 -0
  13. data/examples/rails_root/app/views/user_mailer/newsletter.erb +8 -0
  14. data/examples/rails_root/app/views/user_mailer/signup.erb +3 -0
  15. data/examples/rails_root/app/views/welcome/attachments.html.erb +0 -0
  16. data/examples/rails_root/app/views/welcome/confirm.html.erb +1 -0
  17. data/examples/rails_root/app/views/welcome/index.html.erb +8 -0
  18. data/examples/rails_root/app/views/welcome/newsletter.html.erb +0 -0
  19. data/examples/rails_root/app/views/welcome/signup.html.erb +1 -0
  20. data/examples/rails_root/attachments/document.pdf +0 -0
  21. data/examples/rails_root/attachments/image.png +0 -0
  22. data/examples/rails_root/config/boot.rb +110 -0
  23. data/examples/rails_root/config/cucumber.yml +7 -0
  24. data/examples/rails_root/config/database.yml +25 -0
  25. data/examples/rails_root/config/environment.rb +28 -0
  26. data/examples/rails_root/config/environments/cucumber.rb +29 -0
  27. data/examples/rails_root/config/environments/development.rb +17 -0
  28. data/examples/rails_root/config/environments/production.rb +28 -0
  29. data/examples/rails_root/config/environments/test.rb +28 -0
  30. data/examples/rails_root/config/initializers/inflections.rb +10 -0
  31. data/examples/rails_root/config/initializers/mime_types.rb +5 -0
  32. data/examples/rails_root/config/initializers/new_rails_defaults.rb +17 -0
  33. data/examples/rails_root/config/routes.rb +45 -0
  34. data/examples/rails_root/db/migrate/20090125013728_create_users.rb +11 -0
  35. data/examples/rails_root/db/migrate/20090908054656_create_delayed_jobs.rb +20 -0
  36. data/examples/rails_root/db/schema.rb +32 -0
  37. data/examples/rails_root/doc/README_FOR_APP +5 -0
  38. data/examples/rails_root/features/attachments.feature +27 -0
  39. data/examples/rails_root/features/delayed_job.feature +13 -0
  40. data/examples/rails_root/features/errors.feature +32 -0
  41. data/examples/rails_root/features/example.feature +62 -0
  42. data/examples/rails_root/features/step_definitions/user_steps.rb +26 -0
  43. data/examples/rails_root/features/step_definitions/web_steps.rb +273 -0
  44. data/examples/rails_root/features/support/env.rb +58 -0
  45. data/examples/rails_root/features/support/env_ext.rb +6 -0
  46. data/examples/rails_root/features/support/paths.rb +33 -0
  47. data/examples/rails_root/lib/tasks/cucumber.rake +47 -0
  48. data/examples/rails_root/public/404.html +30 -0
  49. data/examples/rails_root/public/422.html +30 -0
  50. data/examples/rails_root/public/500.html +33 -0
  51. data/examples/rails_root/public/dispatch.rb +10 -0
  52. data/examples/rails_root/public/favicon.ico +0 -0
  53. data/examples/rails_root/public/images/rails.png +0 -0
  54. data/examples/rails_root/public/javascripts/application.js +2 -0
  55. data/examples/rails_root/public/javascripts/controls.js +963 -0
  56. data/examples/rails_root/public/javascripts/dragdrop.js +973 -0
  57. data/examples/rails_root/public/javascripts/effects.js +1128 -0
  58. data/examples/rails_root/public/javascripts/prototype.js +4320 -0
  59. data/examples/rails_root/public/robots.txt +5 -0
  60. data/examples/rails_root/script/about +4 -0
  61. data/examples/rails_root/script/autospec +5 -0
  62. data/examples/rails_root/script/console +3 -0
  63. data/examples/rails_root/script/cucumber +10 -0
  64. data/examples/rails_root/script/dbconsole +3 -0
  65. data/examples/rails_root/script/delayed_job +5 -0
  66. data/examples/rails_root/script/destroy +3 -0
  67. data/examples/rails_root/script/generate +3 -0
  68. data/examples/rails_root/script/performance/benchmarker +3 -0
  69. data/examples/rails_root/script/performance/profiler +3 -0
  70. data/examples/rails_root/script/performance/request +3 -0
  71. data/examples/rails_root/script/plugin +3 -0
  72. data/examples/rails_root/script/process/inspector +3 -0
  73. data/examples/rails_root/script/process/reaper +3 -0
  74. data/examples/rails_root/script/process/spawner +3 -0
  75. data/examples/rails_root/script/runner +3 -0
  76. data/examples/rails_root/script/server +3 -0
  77. data/examples/rails_root/script/spec +5 -0
  78. data/examples/rails_root/script/spec_server +125 -0
  79. data/examples/rails_root/spec/controllers/welcome_controller_spec.rb +15 -0
  80. data/examples/rails_root/spec/model_factory.rb +6 -0
  81. data/examples/rails_root/spec/models/user_mailer_spec.rb +58 -0
  82. data/examples/rails_root/spec/models/user_spec.rb +5 -0
  83. data/examples/rails_root/spec/rcov.opts +2 -0
  84. data/examples/rails_root/spec/spec.opts +4 -0
  85. data/examples/rails_root/spec/spec_helper.rb +51 -0
  86. data/examples/sinatra/app.rb +33 -0
  87. data/examples/sinatra/features/errors.feature +32 -0
  88. data/examples/sinatra/features/example.feature +62 -0
  89. data/examples/sinatra/features/step_definitions/user_steps.rb +26 -0
  90. data/examples/sinatra/features/step_definitions/web_steps.rb +273 -0
  91. data/examples/sinatra/features/support/env.rb +39 -0
  92. data/examples/sinatra/features/support/paths.rb +24 -0
  93. data/install.rb +0 -0
  94. data/lib/email-spec.rb +1 -0
  95. data/lib/email_spec.rb +15 -0
  96. data/lib/email_spec/address_converter.rb +29 -0
  97. data/lib/email_spec/background_processes.rb +45 -0
  98. data/lib/email_spec/cucumber.rb +26 -0
  99. data/lib/email_spec/deliveries.rb +87 -0
  100. data/lib/email_spec/email_viewer.rb +87 -0
  101. data/lib/email_spec/helpers.rb +160 -0
  102. data/lib/email_spec/matchers.rb +217 -0
  103. data/rails_generators/email_spec/email_spec_generator.rb +17 -0
  104. data/rails_generators/email_spec/templates/email_steps.rb +182 -0
  105. data/spec/email_spec/helpers_spec.rb +23 -0
  106. data/spec/email_spec/matchers_spec.rb +240 -0
  107. data/spec/spec.opts +4 -0
  108. data/spec/spec_helper.rb +4 -0
  109. metadata +268 -0
data/History.txt ADDED
@@ -0,0 +1,199 @@
1
+ (In Git)
2
+
3
+ == 0.6.2 2010-03-21
4
+
5
+ === New features
6
+ * New reply_to matcher. (David Balatero)
7
+
8
+ == 0.6.1 2010-03-17
9
+
10
+ === New features
11
+ * Ability to click image links via the image alt tag. (Tim Harper)
12
+
13
+ == 0.6.0 2010-03-05
14
+
15
+ === New features
16
+ * Ability to open a list of attachments on an email (with corresponding steps and EmailViewer support). (Kieran Pilkington)
17
+
18
+ === Bugfixes
19
+ * Spelling mistake in steps. (Ben Mabey)
20
+ * Delayed Job background processor fixes
21
+ * Narrow delayed job collisions with other apps defining Delayed constant. (Kieran Pilkington)
22
+ * Fix compatibility with earlier versions of DelayedJob (Michael Baumgarten and Kieran Pilkington)
23
+
24
+ === Changes
25
+ * Deprecated steps were removed. (Kieran Pilkington)
26
+
27
+ === Bufixes
28
+
29
+ == 0.5.0 2010-02-22
30
+
31
+ === New features
32
+ * "should receive <x> emails with subject <the_subject>" step definition (Balint Erdi)
33
+ * "should receive an email with the following body:" step definition (Ben Mabey)
34
+ * Debugging steps that tie into EmailViewer: (Ben Mabey)
35
+ * "save and open current email"
36
+ * "save and open all text emails"
37
+ * "save and open all html emails"
38
+ * "save and open all raw emails"
39
+
40
+ === Bufixes
41
+ * Gracefully handle cases where emails do not have a 'to' value. (Kieran Pilkington)
42
+
43
+ === Bufixes
44
+
45
+ == 0.4.0 2010-01-07
46
+
47
+ === New features
48
+ * Added support for action_mailer_cache_delivery plugin. (Dan Dofter)
49
+ You must use the fork at: http://github.com/liangzan/action_mailer_cache_delivery
50
+
51
+ === Bufixes
52
+ * be_delivered_from matcher now compares both sender name and email address. (Dan Dofter)
53
+
54
+ == 0.3.8 2009-12-23
55
+
56
+ === Bufixes
57
+ * Guard against cc and bcc fields being nil for ActionMailer. (Piotr Sarnacki)
58
+
59
+ == 0.3.7 2009-12-17
60
+
61
+ === New features
62
+ * Matchers are now Ruby 1.9 compatible. (John Dewey)
63
+
64
+ == 0.3.6 2009-12-16
65
+
66
+ === New features
67
+ * Cucumber steps for be_delivered_from, have_header matchers. (Joseph Holsten)
68
+ * Explicit regular expression steps. i.e. "I should see /foo/ in the email body" (Joseph Holsten)
69
+
70
+ == 0.3.5 2009-09-30 The Pony Release!
71
+
72
+ === New features
73
+ * Support for Pony mailer library. (Rob Holland)
74
+
75
+ == 0.3.4 2009-09-26
76
+
77
+ === Bugfixes
78
+ * Typo and logic fixes for DeliverFrom matcher. (Yury Kotlyarov)
79
+
80
+ == 0.3.3 2009-09-18
81
+
82
+ === New features
83
+ * DeliverFrom matcher. i.e. email.should deliver_from(blah) or email.should be_delivered_from(blah) (Diego Carrion)
84
+
85
+ == 0.3.2 2009-09-10
86
+
87
+ === New features
88
+ * Support for delayed_job. (Kieran Pilkington)
89
+
90
+ == 0.3.1 2009-08-19
91
+ This release is a general refactoring of the steps and helpers.
92
+ The example rails app was also updated to use the lateset rails and webrat. It also takes advantages
93
+ and the newer step definistions including the new third-person forms.
94
+
95
+ Some of the generated steps are being removed in favor of some of the newer ones. The older ones
96
+ will remain until 0.4.0 but will issue deprecation warnings.
97
+
98
+ Big shoutout to Kieran Pilkington who did the majority of work for this release.
99
+
100
+ == 0.3.0 2009-08-13
101
+
102
+ === New features
103
+ * New helper #last_email_address which returns the last address used by email-spec for that scenario. (Ben Mabey)
104
+ * Steps now support third person language. (Kieran P)
105
+ * "[email] should receive ... " now supports "an" instead of just an integer. (Kieran Pilkington)
106
+ With these changes, the following is now possible:
107
+
108
+ Then "jack@example.com" should receive an email
109
+ When they open the email
110
+ Then they should see "Account has been created" in the subject
111
+
112
+ * Additional default steps (Balint Erdi)
113
+ * Then /^I should not receive any emails?$/
114
+ * When %r{^"([^"]*?)" opens? the email$} do |address|
115
+
116
+ === Bufixes
117
+
118
+ == 0.2.1 2009-5-29
119
+
120
+ === New Features
121
+ * BCC RSpec matcher. (Josh Nichols)
122
+
123
+ === Bugfixes
124
+ * Include BCCed and CCed messsages in the mailbox. (Jakub Kosiński)
125
+
126
+ == 0.2.0 2009-6-08
127
+ No changes. Bumping version for RubyForge release.
128
+
129
+
130
+ == 0.1.4 2009-5-29
131
+
132
+ === Bufixes
133
+ * Require deliveries in the helpers so it doesn't blow up with RSpec. (Craig Webster)
134
+
135
+ == 0.1.3 2009-4-15
136
+
137
+ === Bufixes
138
+ * Fixed regular expressions in genertaed steps. (Ben Mabey)
139
+ * World semantics changed in cucumber (0.2.3.2), email_spec now uses the new API. (Hector Morales)
140
+
141
+ == 0.1.2 2009-4-05
142
+
143
+ === New features
144
+ === Bufixes
145
+ * Actually added the renamed generators to the gem so people could use it! D'oh! (Ben Mabey)
146
+ * You can either use "./script generate email_spec" or "rubigen rails email_spec"
147
+ * Removed Rake tasks from example application to prevent conflicts when used as a plugin. (Ben Mabey)
148
+
149
+ == 0.1.1 2009-3-26
150
+ === New features
151
+ * Switched dir structure over to support rubigen. (Dr. Nic)
152
+
153
+ === Bufixes
154
+
155
+ == 0.1.0 2009-3-25
156
+ === New features
157
+ * Change Rakefile to run all specs and features, as well as prepare the db (Mischa Fierer)
158
+ * Allow for array to be passed into deliver_to matcher. (Diego Carrion)
159
+ * Added matcher for checking if a collision of emails includes an email with a particular subject (Luke Melia, Noah Davis)
160
+ * Introduced hook to convert objects to email addresses (Luke Melia and Lee Bankewitz)
161
+
162
+ This allows you, in your step matcher, to say something like:
163
+ maillbox_for(some_user)
164
+
165
+ Use it in your cucumber env.rb like so:
166
+
167
+ EmailSpec::AddressConverter.instance.conversion do |input|
168
+ if input.is_a?(User)
169
+ input.email
170
+ else
171
+ input
172
+ end
173
+ end
174
+
175
+ === Bufixes
176
+ * Revert parse_email_for_link helper method to allow for text links as well as explicit link finding. (Mischa Fierer)
177
+ * Isolated variances between using email-spec with an ARMailer project. (Luke Melia)
178
+
179
+
180
+ == 0.0.9 2009-2-15
181
+ === New features
182
+ * have_body_text, have_header matchers (Luke Melia)
183
+ * EmailViewer - opens all sent emails in a given scenario when the environment variables are set. (Luke Melia)
184
+ * Added compatibility with using ARMailer in test mode. (Luke Melia)
185
+ === Bugfixes
186
+ * set_current_email now works with multiple addresses in To field. (Brian McManus, Ben Mabey)
187
+
188
+ == 0.0.7 2009-1-20
189
+ === New features
190
+ * have_subject matcher (Ben Mabey)
191
+
192
+ == 0.0.6 2008-12-23
193
+ === New features
194
+ * Improved RSpec documentation and refactorings. (Ben Mabey)
195
+ === Bugfixes
196
+ * Removed sample app Rake Tasks to have it play nice with environments that use Cucumber as plugin- not gem. (Ben Mabey, Ivor- on github)
197
+
198
+ == 0.0.5 2008-12-18
199
+ * Initial release - see this post for full history and contributors: http://www.benmabey.com/2008/12/18/github-rocks/
data/MIT-LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2008-2009 Ben Mabey
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,135 @@
1
+ = Email Spec
2
+
3
+ A collection of RSpec matchers and Cucumber steps to make testing emails go smoothly.
4
+
5
+ This library works with ActionMailer and Pony. When using it with ActionMailer it works with
6
+ DelayedJob, ActiveRecord Mailer, and action_mailer_cache_delivery.
7
+
8
+ When using the action_mailer_cache_delivery library you must use this fork:
9
+ http://github.com/liangzan/action_mailer_cache_delivery
10
+
11
+ If you are testing emails in conjunction with an automated browser solution, like Selenium,
12
+ you will want to use action_mailer_cache_delivery in your test environment. (This is
13
+ because your test process and server processes are distinct and therefore need an
14
+ intermediate store for the emails.) DelayedJob and ActiveRecord Mailer will also work but
15
+ you generally don't want to include those projects unless you need them in production.
16
+
17
+ == Setup
18
+
19
+ script/plugin install git://github.com/bmabey/email-spec.git
20
+
21
+ === Gem Setup
22
+
23
+ gem install email_spec
24
+
25
+ # config/environments/test.rb
26
+ config.gem 'email_spec', :lib => 'email_spec'
27
+
28
+ === Cucumber
29
+
30
+ To use the steps in features put the following in your env.rb:
31
+
32
+ # Make sure this require is after you require cucumber/rails/world.
33
+ require 'email_spec/cucumber'
34
+
35
+ This will load all the helpers that the steps rely on.
36
+ It will also add a Before hook for Cucumber so that emails are cleared at the start of each scenario.
37
+
38
+ Then:
39
+
40
+ script/generate email_spec
41
+
42
+ This will give you a bunch of steps to get started with in step_definitions/email_steps.rb
43
+
44
+ === RSpec
45
+
46
+ First you need to require email_spec in your spec_helper.rb:
47
+
48
+ require "email_spec"
49
+
50
+ You will then need to include EmailSpec::Helpers and EmailSpec::Matchers in your example groups.
51
+ If you want to have access to the helpers and matchers in all of your examples you can do the following in your spec_helper.rb:
52
+
53
+ Spec::Runner.configure do |config|
54
+ config.include(EmailSpec::Helpers)
55
+ config.include(EmailSpec::Matchers)
56
+ end
57
+
58
+ Otherwise, you will need to include them in the example groups you wish to use them:
59
+
60
+ describe "Signup Email" do
61
+ include EmailSpec::Helpers
62
+ include EmailSpec::Matchers
63
+ ...
64
+ end
65
+
66
+ == Usage
67
+
68
+ === Cucumber
69
+
70
+ Scenario: A new person signs up
71
+ Given I am at "/"
72
+ When I fill in "Email" with "quentin@example.com"
73
+ And I press "Sign up"
74
+ And I should receive an email
75
+ When I open the email
76
+ Then I should see "confirm" in the email
77
+ When I follow "confirm" in the email
78
+ Then I should see "Confirm your new account"
79
+
80
+ For more examples, check out examples/rails_root in the source for a small example app that implements these steps.
81
+
82
+ === RSpec
83
+
84
+ ==== Testing In Isolation
85
+ It is often useful to test your mailers in isolation. You can accomplish this by using mocks to verify that the mailer is being called in the correct place and then write focued examples for the actual mailer. This is a simple example from the sample app found in the gem:
86
+
87
+ Verify that the mailer is used correctly in the controller (this would apply to a model as well):
88
+
89
+ describe "POST /signup (#signup)" do
90
+ it "should deliver the signup email" do
91
+ # expect
92
+ UserMailer.should_receive(:deliver_signup).with("email@example.com", "Jimmy Bean")
93
+ # when
94
+ post :signup, "Email" => "email@example.com", "Name" => "Jimmy Bean"
95
+ end
96
+ end
97
+
98
+ Examples for the #signup method in UserMailer:
99
+
100
+ describe "Signup Email" do
101
+ include EmailSpec::Helpers
102
+ include EmailSpec::Matchers
103
+ include ActionController::UrlWriter
104
+
105
+ before(:all) do
106
+ @email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks")
107
+ end
108
+
109
+ it "should be set to be delivered to the email passed in" do
110
+ @email.should deliver_to("jojo@yahoo.com")
111
+ end
112
+
113
+ it "should contain the user's message in the mail body" do
114
+ @email.should have_text(/Jojo Binks/)
115
+ end
116
+
117
+ it "should contain a link to the confirmation link" do
118
+ @email.should have_text(/#{confirm_account_url}/)
119
+ end
120
+
121
+ it "should have the correct subject" do
122
+ @email.should have_subject(/Account confirmation/)
123
+ end
124
+
125
+ end
126
+
127
+ ==== Using the helpers when not testing in isolation
128
+
129
+ Don't. :) Seriously, if you do just take a look at the helpers and use them as you wish.
130
+
131
+ == Original Authors
132
+
133
+ Ben Mabey, Aaron Gibralter, Mischa Fierer
134
+
135
+ Please see History.txt for upcoming changsets and other contributors.
data/Rakefile ADDED
@@ -0,0 +1,77 @@
1
+ require 'rubygems'
2
+ require 'spec/rake/spectask'
3
+
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |s|
8
+ s.name = "opsb-email_spec"
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ['Ben Mabey', 'Aaron Gibralter', 'Mischa Fierer']
11
+ s.email = "ben@benmabey.com"
12
+ s.homepage = "http://github.com/bmabey/email-spec/"
13
+ s.summary = "Easily test email in rspec and cucumber"
14
+ s.bindir = "bin"
15
+ s.description = s.summary
16
+ s.require_path = "lib"
17
+ s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["rails_generators/**/*"]
18
+ s.test_files = Dir["spec/**/*"] + Dir["examples/**/*"]
19
+ # rdoc
20
+ s.has_rdoc = true
21
+ s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
22
+ s.rubyforge_project = 'email-spec'
23
+ end
24
+ rescue LoadError
25
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
26
+ end
27
+
28
+ # TODO: switch to gem bundler
29
+ ([['delayed_job', '1.8.4']] + %w[mimetype-fu fixjour pony sinatra rack-test].map{|g| [g]}).each do |gem_args|
30
+ gem_name = gem_args.first
31
+ gem_version = gem_args.size > 1 ? gem_args[1] : nil
32
+ begin
33
+ gem(*[gem_args].flatten)
34
+ rescue Gem::LoadError
35
+ puts "Installing #{gem_name} for the example rails app..."
36
+ puts `gem install #{gem_name} #{gem_version ? ('--version='+gem_version) : ''} --no-rdoc --no-ri`
37
+ end
38
+ end
39
+
40
+ begin
41
+ require 'cucumber/rake/task'
42
+ Cucumber::Rake::Task.new(:features)
43
+ rescue LoadError
44
+ task :features do
45
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
46
+ end
47
+ end
48
+
49
+ require 'spec/rake/spectask'
50
+ Spec::Rake::SpecTask.new(:spec) do |spec|
51
+ spec.libs << 'lib' << 'spec'
52
+ spec.spec_files = FileList['spec/**/*_spec.rb']
53
+ end
54
+
55
+ namespace :example_app do
56
+ Spec::Rake::SpecTask.new(:spec) do |spec|
57
+ desc "Specs for Example app"
58
+ spec.libs << 'lib' << 'spec'
59
+ spec.spec_files = FileList['examples/rails_root/spec/**/*_spec.rb']
60
+ end
61
+ end
62
+
63
+ task :default => [:features, :spec, 'example_app:spec']
64
+
65
+ desc "Cleans the project of any tmp file that should not be included in the gemspec."
66
+ task :clean do
67
+ FileUtils.rm_f('examples/rails_root/features/step_definitions/email_steps.rb')
68
+ FileUtils.rm_rf('examples/rails_root/log')
69
+ FileUtils.rm_rf('examples/rails_root/vendor')
70
+ %w[*.sqlite3 *.log].each do |pattern|
71
+ `find . -name "#{pattern}" -delete`
72
+ end
73
+ end
74
+
75
+ desc "Cleans the dir and builds the gem"
76
+ task :prep => [:clean, :gemspec, :build]
77
+
@@ -0,0 +1,13 @@
1
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
2
+
3
+ require 'rake'
4
+ require 'rake/testtask'
5
+ require 'rake/rdoctask'
6
+
7
+ require 'tasks/rails'
8
+
9
+ begin
10
+ require 'delayed/tasks'
11
+ rescue LoadError
12
+ STDERR.puts "Run `rake gems:install` to install delayed_job"
13
+ end