path-email_spec 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/History.txt +199 -0
  2. data/MIT-LICENSE.txt +19 -0
  3. data/README.rdoc +137 -0
  4. data/Rakefile +64 -0
  5. data/examples/rails3_root/Gemfile +24 -0
  6. data/examples/rails3_root/README +5 -0
  7. data/examples/rails3_root/Rakefile +11 -0
  8. data/examples/rails3_root/app/controllers/application_controller.rb +3 -0
  9. data/examples/rails3_root/app/controllers/welcome_controller.rb +16 -0
  10. data/examples/rails3_root/app/helpers/application_helper.rb +2 -0
  11. data/examples/rails3_root/app/mailers/user_mailer.rb +39 -0
  12. data/examples/rails3_root/app/models/user.rb +2 -0
  13. data/examples/rails3_root/app/views/user_mailer/attachments.html.erb +6 -0
  14. data/examples/rails3_root/app/views/user_mailer/newsletter.html.erb +8 -0
  15. data/examples/rails3_root/app/views/user_mailer/signup.html.erb +3 -0
  16. data/examples/rails3_root/app/views/welcome/attachments.html.erb +0 -0
  17. data/examples/rails3_root/app/views/welcome/confirm.html.erb +1 -0
  18. data/examples/rails3_root/app/views/welcome/index.html.erb +8 -0
  19. data/examples/rails3_root/app/views/welcome/newsletter.html.erb +0 -0
  20. data/examples/rails3_root/app/views/welcome/signup.html.erb +1 -0
  21. data/examples/rails3_root/attachments/document.pdf +0 -0
  22. data/examples/rails3_root/attachments/image.png +0 -0
  23. data/examples/rails3_root/config.ru +4 -0
  24. data/examples/rails3_root/config/application.rb +43 -0
  25. data/examples/rails3_root/config/boot.rb +14 -0
  26. data/examples/rails3_root/config/cucumber.yml +7 -0
  27. data/examples/rails3_root/config/database.yml +25 -0
  28. data/examples/rails3_root/config/environment.rb +6 -0
  29. data/examples/rails3_root/config/environments/development.rb +19 -0
  30. data/examples/rails3_root/config/environments/production.rb +42 -0
  31. data/examples/rails3_root/config/environments/test.rb +29 -0
  32. data/examples/rails3_root/config/initializers/backtrace_silencers.rb +7 -0
  33. data/examples/rails3_root/config/initializers/cookie_verification_secret.rb +7 -0
  34. data/examples/rails3_root/config/initializers/inflections.rb +10 -0
  35. data/examples/rails3_root/config/initializers/mime_types.rb +5 -0
  36. data/examples/rails3_root/config/initializers/rspec_generator.rb +6 -0
  37. data/examples/rails3_root/config/initializers/session_store.rb +10 -0
  38. data/examples/rails3_root/config/locales/en.yml +5 -0
  39. data/examples/rails3_root/config/routes.rb +7 -0
  40. data/examples/rails3_root/db/migrate/20090125013728_create_users.rb +11 -0
  41. data/examples/rails3_root/db/migrate/20090908054656_create_delayed_jobs.rb +20 -0
  42. data/examples/rails3_root/db/schema.rb +32 -0
  43. data/examples/rails3_root/db/seeds.rb +7 -0
  44. data/examples/rails3_root/doc/README_FOR_APP +2 -0
  45. data/examples/rails3_root/features/attachments.feature +27 -0
  46. data/examples/rails3_root/features/delayed_job.feature +13 -0
  47. data/examples/rails3_root/features/errors.feature +32 -0
  48. data/examples/rails3_root/features/example.feature +62 -0
  49. data/examples/rails3_root/features/step_definitions/user_steps.rb +26 -0
  50. data/examples/rails3_root/features/step_definitions/web_steps.rb +202 -0
  51. data/examples/rails3_root/features/support/env.rb +59 -0
  52. data/examples/rails3_root/features/support/env_ext.rb +2 -0
  53. data/examples/rails3_root/features/support/paths.rb +33 -0
  54. data/examples/rails3_root/lib/tasks/cucumber.rake +47 -0
  55. data/examples/rails3_root/lib/tasks/rspec.rake +69 -0
  56. data/examples/rails3_root/public/404.html +26 -0
  57. data/examples/rails3_root/public/422.html +26 -0
  58. data/examples/rails3_root/public/500.html +26 -0
  59. data/examples/rails3_root/public/favicon.ico +0 -0
  60. data/examples/rails3_root/public/images/rails.png +0 -0
  61. data/examples/rails3_root/public/javascripts/application.js +2 -0
  62. data/examples/rails3_root/public/javascripts/controls.js +965 -0
  63. data/examples/rails3_root/public/javascripts/dragdrop.js +974 -0
  64. data/examples/rails3_root/public/javascripts/effects.js +1123 -0
  65. data/examples/rails3_root/public/javascripts/prototype.js +4874 -0
  66. data/examples/rails3_root/public/javascripts/rails.js +109 -0
  67. data/examples/rails3_root/public/robots.txt +5 -0
  68. data/examples/rails3_root/script/cucumber +10 -0
  69. data/examples/rails3_root/script/rails +9 -0
  70. data/examples/rails3_root/spec/controllers/welcome_controller_spec.rb +18 -0
  71. data/examples/rails3_root/spec/models/user_mailer_spec.rb +47 -0
  72. data/examples/rails3_root/spec/spec.opts +2 -0
  73. data/examples/rails3_root/spec/spec_helper.rb +19 -0
  74. data/examples/rails_root/Rakefile +13 -0
  75. data/examples/rails_root/app/controllers/application_controller.rb +15 -0
  76. data/examples/rails_root/app/controllers/welcome_controller.rb +16 -0
  77. data/examples/rails_root/app/helpers/application_helper.rb +3 -0
  78. data/examples/rails_root/app/helpers/welcome_helper.rb +2 -0
  79. data/examples/rails_root/app/models/user.rb +2 -0
  80. data/examples/rails_root/app/models/user_mailer.rb +39 -0
  81. data/examples/rails_root/app/views/user_mailer/attachments.erb +6 -0
  82. data/examples/rails_root/app/views/user_mailer/newsletter.erb +8 -0
  83. data/examples/rails_root/app/views/user_mailer/signup.erb +3 -0
  84. data/examples/rails_root/app/views/welcome/attachments.html.erb +0 -0
  85. data/examples/rails_root/app/views/welcome/confirm.html.erb +1 -0
  86. data/examples/rails_root/app/views/welcome/index.html.erb +8 -0
  87. data/examples/rails_root/app/views/welcome/newsletter.html.erb +0 -0
  88. data/examples/rails_root/app/views/welcome/signup.html.erb +1 -0
  89. data/examples/rails_root/attachments/document.pdf +0 -0
  90. data/examples/rails_root/attachments/image.png +0 -0
  91. data/examples/rails_root/config/boot.rb +110 -0
  92. data/examples/rails_root/config/cucumber.yml +7 -0
  93. data/examples/rails_root/config/database.yml +25 -0
  94. data/examples/rails_root/config/environment.rb +28 -0
  95. data/examples/rails_root/config/environments/cucumber.rb +29 -0
  96. data/examples/rails_root/config/environments/development.rb +17 -0
  97. data/examples/rails_root/config/environments/production.rb +28 -0
  98. data/examples/rails_root/config/environments/test.rb +28 -0
  99. data/examples/rails_root/config/initializers/inflections.rb +10 -0
  100. data/examples/rails_root/config/initializers/mime_types.rb +5 -0
  101. data/examples/rails_root/config/initializers/new_rails_defaults.rb +17 -0
  102. data/examples/rails_root/config/routes.rb +45 -0
  103. data/examples/rails_root/db/migrate/20090125013728_create_users.rb +11 -0
  104. data/examples/rails_root/db/migrate/20090908054656_create_delayed_jobs.rb +20 -0
  105. data/examples/rails_root/db/schema.rb +32 -0
  106. data/examples/rails_root/doc/README_FOR_APP +5 -0
  107. data/examples/rails_root/features/attachments.feature +27 -0
  108. data/examples/rails_root/features/delayed_job.feature +13 -0
  109. data/examples/rails_root/features/errors.feature +32 -0
  110. data/examples/rails_root/features/example.feature +62 -0
  111. data/examples/rails_root/features/step_definitions/user_steps.rb +26 -0
  112. data/examples/rails_root/features/step_definitions/web_steps.rb +273 -0
  113. data/examples/rails_root/features/support/env.rb +58 -0
  114. data/examples/rails_root/features/support/env_ext.rb +6 -0
  115. data/examples/rails_root/features/support/paths.rb +33 -0
  116. data/examples/rails_root/lib/tasks/cucumber.rake +47 -0
  117. data/examples/rails_root/public/404.html +30 -0
  118. data/examples/rails_root/public/422.html +30 -0
  119. data/examples/rails_root/public/500.html +33 -0
  120. data/examples/rails_root/public/dispatch.rb +10 -0
  121. data/examples/rails_root/public/favicon.ico +0 -0
  122. data/examples/rails_root/public/images/rails.png +0 -0
  123. data/examples/rails_root/public/javascripts/application.js +2 -0
  124. data/examples/rails_root/public/javascripts/controls.js +963 -0
  125. data/examples/rails_root/public/javascripts/dragdrop.js +973 -0
  126. data/examples/rails_root/public/javascripts/effects.js +1128 -0
  127. data/examples/rails_root/public/javascripts/prototype.js +4320 -0
  128. data/examples/rails_root/public/robots.txt +5 -0
  129. data/examples/rails_root/script/about +4 -0
  130. data/examples/rails_root/script/autospec +5 -0
  131. data/examples/rails_root/script/console +3 -0
  132. data/examples/rails_root/script/cucumber +10 -0
  133. data/examples/rails_root/script/dbconsole +3 -0
  134. data/examples/rails_root/script/delayed_job +5 -0
  135. data/examples/rails_root/script/destroy +3 -0
  136. data/examples/rails_root/script/generate +3 -0
  137. data/examples/rails_root/script/performance/benchmarker +3 -0
  138. data/examples/rails_root/script/performance/profiler +3 -0
  139. data/examples/rails_root/script/performance/request +3 -0
  140. data/examples/rails_root/script/plugin +3 -0
  141. data/examples/rails_root/script/process/inspector +3 -0
  142. data/examples/rails_root/script/process/reaper +3 -0
  143. data/examples/rails_root/script/process/spawner +3 -0
  144. data/examples/rails_root/script/runner +3 -0
  145. data/examples/rails_root/script/server +3 -0
  146. data/examples/rails_root/script/spec +5 -0
  147. data/examples/rails_root/script/spec_server +125 -0
  148. data/examples/rails_root/spec/controllers/welcome_controller_spec.rb +15 -0
  149. data/examples/rails_root/spec/model_factory.rb +6 -0
  150. data/examples/rails_root/spec/models/user_mailer_spec.rb +58 -0
  151. data/examples/rails_root/spec/models/user_spec.rb +5 -0
  152. data/examples/rails_root/spec/rcov.opts +2 -0
  153. data/examples/rails_root/spec/spec.opts +4 -0
  154. data/examples/rails_root/spec/spec_helper.rb +51 -0
  155. data/examples/sinatra/app.rb +33 -0
  156. data/examples/sinatra/features/errors.feature +32 -0
  157. data/examples/sinatra/features/example.feature +62 -0
  158. data/examples/sinatra/features/step_definitions/user_steps.rb +26 -0
  159. data/examples/sinatra/features/step_definitions/web_steps.rb +273 -0
  160. data/examples/sinatra/features/support/env.rb +39 -0
  161. data/examples/sinatra/features/support/paths.rb +24 -0
  162. data/install.rb +0 -0
  163. data/lib/email-spec.rb +1 -0
  164. data/lib/email_spec.rb +15 -0
  165. data/lib/email_spec/address_converter.rb +29 -0
  166. data/lib/email_spec/background_processes.rb +45 -0
  167. data/lib/email_spec/cucumber.rb +26 -0
  168. data/lib/email_spec/deliveries.rb +87 -0
  169. data/lib/email_spec/email_viewer.rb +87 -0
  170. data/lib/email_spec/helpers.rb +164 -0
  171. data/lib/email_spec/matchers.rb +225 -0
  172. data/lib/generators/email_spec/steps/USAGE +5 -0
  173. data/lib/generators/email_spec/steps/steps_generator.rb +14 -0
  174. data/lib/generators/email_spec/steps/templates/email_steps.rb +194 -0
  175. data/rails_generators/email_spec/email_spec_generator.rb +17 -0
  176. data/rails_generators/email_spec/templates/email_steps.rb +182 -0
  177. data/spec/email_spec/helpers_spec.rb +21 -0
  178. data/spec/email_spec/matchers_spec.rb +430 -0
  179. data/spec/spec_helper.rb +16 -0
  180. metadata +407 -0
@@ -0,0 +1,7 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %>
7
+ wip: --tags @wip:3 --wip features
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test: &TEST
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
23
+
24
+ cucumber:
25
+ <<: *TEST
@@ -0,0 +1,28 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Uncomment below to force Rails into production mode when
4
+ # you don't control web/app server and can't set it the proper way
5
+ # ENV['RAILS_ENV'] ||= 'production'
6
+
7
+ # Specifies gem version of Rails to use when vendor/rails is not present
8
+ RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
9
+
10
+ # Bootstrap the Rails environment, frameworks, and default configuration
11
+ require File.join(File.dirname(__FILE__), 'boot')
12
+
13
+ Rails::Initializer.run do |config|
14
+
15
+ config.action_mailer.default_url_options = { :host => "example.com" }
16
+
17
+ config.gem 'fixjour', :lib => 'fixjour'
18
+ config.gem 'delayed_job', :lib => 'delayed_job'
19
+ config.gem 'mimetype-fu', :lib => 'mimetype_fu'
20
+
21
+ config.time_zone = 'UTC'
22
+
23
+ config.action_controller.session = {
24
+ :session_key => '_es_session',
25
+ :secret => 'b9327c7967925fb36f8901e43f47e0a3e8fc7856ae1b4533ddeda776381548f9ac051721446fdbc4ccc88c7353124708e73d8b0950a30487571d8f8eb5b24732'
26
+ }
27
+
28
+ end
@@ -0,0 +1,29 @@
1
+ # Edit at your own peril - it's recommended to regenerate this file
2
+ # in the future when you upgrade to a newer version of Cucumber.
3
+
4
+ # IMPORTANT: Setting config.cache_classes to false is known to
5
+ # break Cucumber's use_transactional_fixtures method.
6
+ # For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Disable request forgery protection in test environment
17
+ config.action_controller.allow_forgery_protection = false
18
+
19
+ # Tell Action Mailer not to deliver emails to the real world.
20
+ # The :test delivery method accumulates sent emails in the
21
+ # ActionMailer::Base.deliveries array.
22
+ config.action_mailer.delivery_method = :test
23
+
24
+ config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
25
+ config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
26
+ config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
27
+ config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
28
+ config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
29
+
@@ -0,0 +1,17 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_view.debug_rjs = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.action_controller.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+ config.action_view.cache_template_loading = true
11
+
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
+
21
+ # Enable serving of images, stylesheets, and javascripts from an asset server
22
+ # config.action_controller.asset_host = "http://assets.example.com"
23
+
24
+ # Disable delivery errors, bad email addresses will be ignored
25
+ # config.action_mailer.raise_delivery_errors = false
26
+
27
+ # Enable threaded mode
28
+ # config.threadsafe!
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+ config.action_view.cache_template_loading = true
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,17 @@
1
+ # These settings change the behavior of Rails 2 apps and will be defaults
2
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
3
+
4
+ if defined?(ActiveRecord)
5
+ # Include Active Record class name as root for JSON serialized output.
6
+ ActiveRecord::Base.include_root_in_json = true
7
+
8
+ # Store the full class name (including module namespace) in STI type column.
9
+ ActiveRecord::Base.store_full_sti_class = true
10
+ end
11
+
12
+ # Use ISO 8601 format for JSON serialized times and dates.
13
+ ActiveSupport.use_standard_json_time_format = true
14
+
15
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
16
+ # if you're including raw json in an HTML page.
17
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,45 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+
4
+ # Sample of regular route:
5
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6
+ # Keep in mind you can assign values other than :controller and :action
7
+
8
+ # Sample of named route:
9
+ # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
+ # This route can be invoked with purchase_url(:id => product.id)
11
+
12
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
13
+ # map.resources :products
14
+
15
+ # Sample resource route with options:
16
+ # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
+
18
+ # Sample resource route with sub-resources:
19
+ # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
+
21
+ # Sample resource route with more complex sub-resources
22
+ # map.resources :products do |products|
23
+ # products.resources :comments
24
+ # products.resources :sales, :collection => { :recent => :get }
25
+ # end
26
+
27
+ # Sample resource route within a namespace:
28
+ # map.namespace :admin do |admin|
29
+ # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
30
+ # admin.resources :products
31
+ # end
32
+
33
+ # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
34
+ map.root :controller => "welcome", :action => "index"
35
+ map.confirm_account "/confirm", :controller => "welcome", :action => "confirm"
36
+ map.request_newsletter "/newsletter", :controller => "welcome", :action => "newsletter"
37
+ map.request_attachments "/attachments", :controller => "welcome", :action => "attachments"
38
+ # See how all your routes lay out with "rake routes"
39
+
40
+ # Install the default routes as the lowest priority.
41
+ # Note: These default routes make all actions in every controller accessible via GET requests. You should
42
+ # consider removing the them or commenting them out if you're using named routes and resources.
43
+ map.connect ':controller/:action/:id'
44
+ map.connect ':controller/:action/:id.:format'
45
+ end
@@ -0,0 +1,11 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :email, :name
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :users
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ class CreateDelayedJobs < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :delayed_jobs, :force => true do |table|
4
+ table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
5
+ table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
6
+ table.text :handler # YAML-encoded string of the object that will do work
7
+ table.text :last_error # reason for last failure (See Note below)
8
+ table.datetime :run_at # When to run. Could be Time.now for immediately, or sometime in the future.
9
+ table.datetime :locked_at # Set when a client is working on this object
10
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
11
+ table.string :locked_by # Who is working on this object (if locked)
12
+ table.timestamps
13
+ end
14
+
15
+ end
16
+
17
+ def self.down
18
+ drop_table :delayed_jobs
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
11
+
12
+ ActiveRecord::Schema.define(:version => 20090908054656) do
13
+
14
+ create_table "delayed_jobs", :force => true do |t|
15
+ t.integer "priority", :default => 0
16
+ t.integer "attempts", :default => 0
17
+ t.text "handler"
18
+ t.text "last_error"
19
+ t.datetime "run_at"
20
+ t.datetime "locked_at"
21
+ t.datetime "failed_at"
22
+ t.string "locked_by"
23
+ t.datetime "created_at"
24
+ t.datetime "updated_at"
25
+ end
26
+
27
+ create_table "users", :force => true do |t|
28
+ t.string "email"
29
+ t.string "name"
30
+ end
31
+
32
+ end
@@ -0,0 +1,5 @@
1
+ To build the guides:
2
+
3
+ * Install source-highlighter (http://www.gnu.org/software/src-highlite/source-highlight.html)
4
+ * Install the mizuho gem (http://github.com/FooBarWidget/mizuho/tree/master)
5
+ * Run `rake guides` from the railties directory
@@ -0,0 +1,27 @@
1
+ Feature: Attachment testing support
2
+ In order for developers to test attachments in emails
3
+ I want to be able to provide working steps which inspect attachments
4
+
5
+ Scenario: Email with Attachments
6
+ Given no emails have been sent
7
+ And I go to request attachments be sent to me
8
+ Then I should receive an email
9
+ When I open the email
10
+ Then I should see 2 attachments with the email
11
+ And there should be an attachment named "image.png"
12
+ And there should be an attachment named "document.pdf"
13
+ And attachment 1 should be named "image.png"
14
+ And attachment 2 should be named "document.pdf"
15
+ And there should be an attachment of type "image/png"
16
+ And there should be an attachment of type "application/pdf"
17
+ And attachment 1 should be of type "image/png"
18
+ And attachment 2 should be of type "application/pdf"
19
+ And all attachments should not be blank
20
+
21
+ Scenario: Email without Attachments
22
+ Given no emails have been sent
23
+ And I am on the homepage
24
+ And I submit my registration information
25
+ Then I should receive an email
26
+ When I open the email
27
+ Then I should see no attachments with the email
@@ -0,0 +1,13 @@
1
+ Feature: Delayed Job support
2
+ In order for developers using delayed_job to test emails
3
+ I want to be able to provide a compatibility layer, which
4
+ should run all delayed jobs before checking email boxes
5
+ In order to populate deliveries done via send_later
6
+
7
+ Scenario: Newsletter
8
+ Given no emails have been sent
9
+ And I go to request a newsletter
10
+ Then I should receive an email
11
+ And I should have 1 email
12
+ When I open the email
13
+ Then I should see "Newsletter sent" in the email subject
@@ -0,0 +1,32 @@
1
+ Feature: Email-spec errors example
2
+ In order to help alleviate email testing in apps
3
+ As a email-spec contributor I a newcomer
4
+ Should be able to easily determine where I have gone wrong
5
+ These scenarios should fail with helpful messages
6
+
7
+ Background:
8
+ Given I am on the homepage
9
+ And no emails have been sent
10
+ When I fill in "Email" with "example@example.com"
11
+ And I press "Sign up"
12
+
13
+ Scenario: I fail to open an email with incorrect subject
14
+ Then I should receive an email
15
+ When "example@example.com" opens the email with subject "no email"
16
+
17
+ Scenario: I fail to open an email with incorrect text
18
+ Then I should receive an email
19
+ When "example@example.com" opens the email with text "no email"
20
+
21
+ Scenario: I fail to receive an email with the expected link
22
+ Then I should receive an email
23
+ When I open the email
24
+ When I follow "link that doesn't exist" in the email
25
+
26
+ Scenario: I attempt to operate on an email that is not opened
27
+ Then I should receive an email
28
+ When I follow "confirm" in the email
29
+
30
+ Scenario: I attempt to check out an unopened email
31
+ Then I should see "confirm" in the email body
32
+ And I should see "Account confirmation" in the email subject
@@ -0,0 +1,62 @@
1
+ Feature: EmailSpec Example -- Prevent Bots from creating accounts
2
+
3
+ In order to help alleviate email testing in apps
4
+ As an email-spec contributor I want new users of the library
5
+ to easily adopt email-spec in their app by following this example
6
+
7
+ In order to prevent bots from setting up new accounts
8
+ As a site manager I want new users
9
+ to verify their email address with a confirmation link
10
+
11
+ Background:
12
+ Given no emails have been sent
13
+ And I am a real person wanting to sign up for an account
14
+ And I am on the homepage
15
+ And I submit my registration information
16
+
17
+ Scenario: First person signup (as myself) with two ways of opening email
18
+ Then I should receive an email
19
+ And I should have 1 email
20
+
21
+ # Opening email #1
22
+ When I open the email
23
+ Then I should see "Account confirmation" in the email subject
24
+ And I should see "Joe Someone" in the email body
25
+ And I should see "confirm" in the email body
26
+
27
+ # Opening email #2
28
+ When I open the email with subject "Account confirmation"
29
+ Then I should see "Account confirmation" in the email subject
30
+ And I should see "Joe Someone" in the email body
31
+ And I should see "confirm" in the email body
32
+
33
+ When I follow "Click here to confirm your account!" in the email
34
+ Then I should see "Confirm your new account"
35
+
36
+ And "foo@bar.com" should have no emails
37
+
38
+ Scenario: Third person signup (emails sent to others) with two ways of opening email
39
+ Then "foo@bar.com" should have no emails
40
+ And "example@example.com" should receive an email
41
+ And "example@example.com" should have 1 email
42
+
43
+ # Opening email #1
44
+ When they open the email
45
+ Then they should see "Account confirmation" in the email subject
46
+ And they should see "Joe Someone" in the email body
47
+ And they should see "confirm" in the email body
48
+
49
+ # Opening email #2
50
+ When "example@example.com" opens the email with subject "Account confirmation"
51
+ Then they should see "Account confirmation" in the email subject
52
+ And they should see "Joe Someone" in the email body
53
+ And they should see "confirm" in the email body
54
+
55
+ When they follow "Click here to confirm your account!" in the email
56
+ Then they should see "Confirm your new account"
57
+
58
+ Scenario: Declarative First Person signup
59
+ Then I should receive an email with a link to a confirmation page
60
+
61
+ Scenario: Declarative First Person signup
62
+ Then they should receive an email with a link to a confirmation page