Permalink
Browse files

Braid: Added mirror 'vendor/plugins/email-spec' at '4e14cc2'

  • Loading branch information...
1 parent f9befdd commit 1f01fd1a723356d0247a008d2ba92292d4111ef1 Andrew Bruce committed Jun 22, 2009
Showing with 9,832 additions and 0 deletions.
  1. +7 −0 .braids
  2. +5 −0 vendor/plugins/email-spec/.gitignore
  3. +79 −0 vendor/plugins/email-spec/History.txt
  4. +19 −0 vendor/plugins/email-spec/MIT-LICENSE.txt
  5. +125 −0 vendor/plugins/email-spec/README.rdoc
  6. +51 −0 vendor/plugins/email-spec/Rakefile
  7. +4 −0 vendor/plugins/email-spec/VERSION.yml
  8. +159 −0 vendor/plugins/email-spec/email_spec.gemspec
  9. +7 −0 vendor/plugins/email-spec/examples/rails_root/Rakefile
  10. +15 −0 vendor/plugins/email-spec/examples/rails_root/app/controllers/application.rb
  11. +9 −0 vendor/plugins/email-spec/examples/rails_root/app/controllers/welcome_controller.rb
  12. +3 −0 vendor/plugins/email-spec/examples/rails_root/app/helpers/application_helper.rb
  13. +2 −0 vendor/plugins/email-spec/examples/rails_root/app/helpers/welcome_helper.rb
  14. +2 −0 vendor/plugins/email-spec/examples/rails_root/app/models/user.rb
  15. +12 −0 vendor/plugins/email-spec/examples/rails_root/app/models/user_mailer.rb
  16. +3 −0 vendor/plugins/email-spec/examples/rails_root/app/views/user_mailer/signup.erb
  17. +1 −0 vendor/plugins/email-spec/examples/rails_root/app/views/welcome/confirm.html.erb
  18. +8 −0 vendor/plugins/email-spec/examples/rails_root/app/views/welcome/index.html.erb
  19. +1 −0 vendor/plugins/email-spec/examples/rails_root/app/views/welcome/signup.html.erb
  20. +109 −0 vendor/plugins/email-spec/examples/rails_root/config/boot.rb
  21. +22 −0 vendor/plugins/email-spec/examples/rails_root/config/database.yml
  22. +22 −0 vendor/plugins/email-spec/examples/rails_root/config/environment.rb
  23. +17 −0 vendor/plugins/email-spec/examples/rails_root/config/environments/development.rb
  24. +24 −0 vendor/plugins/email-spec/examples/rails_root/config/environments/production.rb
  25. +33 −0 vendor/plugins/email-spec/examples/rails_root/config/environments/test.rb
  26. +10 −0 vendor/plugins/email-spec/examples/rails_root/config/initializers/inflections.rb
  27. +5 −0 vendor/plugins/email-spec/examples/rails_root/config/initializers/mime_types.rb
  28. +17 −0 vendor/plugins/email-spec/examples/rails_root/config/initializers/new_rails_defaults.rb
  29. +43 −0 vendor/plugins/email-spec/examples/rails_root/config/routes.rb
  30. +1 −0 vendor/plugins/email-spec/examples/rails_root/cucumber.yml
  31. +11 −0 vendor/plugins/email-spec/examples/rails_root/db/migrate/20090125013728_create_users.rb
  32. +19 −0 vendor/plugins/email-spec/examples/rails_root/db/schema.rb
  33. +5 −0 vendor/plugins/email-spec/examples/rails_root/doc/README_FOR_APP
  34. +42 −0 vendor/plugins/email-spec/examples/rails_root/features/errors.feature
  35. +59 −0 vendor/plugins/email-spec/examples/rails_root/features/example.feature
  36. +74 −0 vendor/plugins/email-spec/examples/rails_root/features/step_definitions/email_steps.rb
  37. +23 −0 vendor/plugins/email-spec/examples/rails_root/features/step_definitions/user_steps.rb
  38. +104 −0 vendor/plugins/email-spec/examples/rails_root/features/step_definitions/webrat_steps.rb
  39. +21 −0 vendor/plugins/email-spec/examples/rails_root/features/support/env.rb
  40. +30 −0 vendor/plugins/email-spec/examples/rails_root/public/404.html
  41. +30 −0 vendor/plugins/email-spec/examples/rails_root/public/422.html
  42. +33 −0 vendor/plugins/email-spec/examples/rails_root/public/500.html
  43. +10 −0 vendor/plugins/email-spec/examples/rails_root/public/dispatch.rb
  44. 0 vendor/plugins/email-spec/examples/rails_root/public/favicon.ico
  45. BIN vendor/plugins/email-spec/examples/rails_root/public/images/rails.png
  46. +2 −0 vendor/plugins/email-spec/examples/rails_root/public/javascripts/application.js
  47. +963 −0 vendor/plugins/email-spec/examples/rails_root/public/javascripts/controls.js
  48. +973 −0 vendor/plugins/email-spec/examples/rails_root/public/javascripts/dragdrop.js
  49. +1,128 −0 vendor/plugins/email-spec/examples/rails_root/public/javascripts/effects.js
  50. +4,320 −0 vendor/plugins/email-spec/examples/rails_root/public/javascripts/prototype.js
  51. +5 −0 vendor/plugins/email-spec/examples/rails_root/public/robots.txt
  52. +4 −0 vendor/plugins/email-spec/examples/rails_root/script/about
  53. +5 −0 vendor/plugins/email-spec/examples/rails_root/script/autospec
  54. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/console
  55. +7 −0 vendor/plugins/email-spec/examples/rails_root/script/cucumber
  56. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/dbconsole
  57. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/destroy
  58. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/generate
  59. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/performance/benchmarker
  60. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/performance/profiler
  61. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/performance/request
  62. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/plugin
  63. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/process/inspector
  64. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/process/reaper
  65. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/process/spawner
  66. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/runner
  67. +3 −0 vendor/plugins/email-spec/examples/rails_root/script/server
  68. +5 −0 vendor/plugins/email-spec/examples/rails_root/script/spec
  69. +125 −0 vendor/plugins/email-spec/examples/rails_root/script/spec_server
  70. +15 −0 vendor/plugins/email-spec/examples/rails_root/spec/controllers/welcome_controller_spec.rb
  71. +6 −0 vendor/plugins/email-spec/examples/rails_root/spec/model_factory.rb
  72. +58 −0 vendor/plugins/email-spec/examples/rails_root/spec/models/user_mailer_spec.rb
  73. +5 −0 vendor/plugins/email-spec/examples/rails_root/spec/models/user_spec.rb
  74. +2 −0 vendor/plugins/email-spec/examples/rails_root/spec/rcov.opts
  75. +4 −0 vendor/plugins/email-spec/examples/rails_root/spec/spec.opts
  76. +51 −0 vendor/plugins/email-spec/examples/rails_root/spec/spec_helper.rb
  77. +4 −0 vendor/plugins/email-spec/examples/rails_root/stories/all.rb
  78. +3 −0 vendor/plugins/email-spec/examples/rails_root/stories/helper.rb
  79. +17 −0 ...examples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/email_spec_generator.rb
  80. +74 −0 ...xamples/rails_root/vendor/plugins/email_spec/rails_generators/email_spec/templates/email_steps.rb
  81. +16 −0 vendor/plugins/email-spec/features/rails_app.feature
  82. +26 −0 vendor/plugins/email-spec/features/rails_app_steps.rb
  83. +4 −0 vendor/plugins/email-spec/features/support/env.rb
  84. 0 vendor/plugins/email-spec/install.rb
  85. +1 −0 vendor/plugins/email-spec/lib/email-spec.rb
  86. +14 −0 vendor/plugins/email-spec/lib/email_spec.rb
  87. +27 −0 vendor/plugins/email-spec/lib/email_spec/address_converter.rb
  88. +19 −0 vendor/plugins/email-spec/lib/email_spec/cucumber.rb
  89. +55 −0 vendor/plugins/email-spec/lib/email_spec/deliveries.rb
  90. +70 −0 vendor/plugins/email-spec/lib/email_spec/email_viewer.rb
  91. +129 −0 vendor/plugins/email-spec/lib/email_spec/helpers.rb
  92. +122 −0 vendor/plugins/email-spec/lib/email_spec/matchers.rb
  93. +17 −0 vendor/plugins/email-spec/rails_generators/email_spec/email_spec_generator.rb
  94. +74 −0 vendor/plugins/email-spec/rails_generators/email_spec/templates/email_steps.rb
  95. +159 −0 vendor/plugins/email-spec/spec/email_spec/matchers_spec.rb
  96. +4 −0 vendor/plugins/email-spec/spec/spec.opts
  97. +4 −0 vendor/plugins/email-spec/spec/spec_helper.rb
View
@@ -34,6 +34,13 @@ vendor/plugins/validates_email_format_of:
type: git
revision: 57baad6e4a87eea20505e8b18628390559afbf3d
remote: braid/vendor/plugins/validates-email-format-of
+vendor/plugins/email-spec:
+ squashed: true
+ url: git://github.com/bmabey/email-spec.git
+ branch: master
+ type: git
+ revision: 4e14cc22826e548d3ec01101a7c335033474f7a7
+ remote: braid/vendor/plugins/email-spec
vendor/plugins/no-peeping-toms:
squashed: true
url: http://github.com/pat-maddox/no-peeping-toms.git
@@ -0,0 +1,5 @@
+.DS_Store
+*.sw?
+*.log
+*.sqlite3
+pkg
@@ -0,0 +1,79 @@
+(In Git)
+
+ === New features
+ === Bufixes
+
+== 0.2.0 2009-6-08
+No changes. Bumping version for RubyForge release.
+
+
+ == 0.1.4 2009-5-29
+
+ === Bufixes
+ * Require deliveries in the helpers so it doesn't blow up with RSpec. (Craig Webster)
+
+ == 0.1.3 2009-4-15
+
+ === Bufixes
+ * Fixed regular expressions in genertaed steps. (Ben Mabey)
+ * World semantics changed in cucumber (0.2.3.2), email_spec now uses the new API. (Hector Morales)
+
+ == 0.1.2 2009-4-05
+
+ === New features
+ === Bufixes
+ * Actually added the renamed generators to the gem so people could use it! D'oh! (Ben Mabey)
+ * You can either use "./script generate email_spec" or "rubigen rails email_spec"
+ * Removed Rake tasks from example application to prevent conflicts when used as a plugin. (Ben Mabey)
+
+ == 0.1.1 2009-3-26
+ === New features
+ * Switched dir structure over to support rubigen. (Dr. Nic)
+
+ === Bufixes
+
+ == 0.1.0 2009-3-25
+ === New features
+ * Change Rakefile to run all specs and features, as well as prepare the db (Mischa Fierer)
+ * Allow for array to be passed into deliver_to matcher. (Diego Carrion)
+ * Added matcher for checking if a collection of emails includes an email with a particular subject (Luke Melia, Noah Davis)
+ * Introduced hook to convert objects to email addresses (Luke Melia and Lee Bankewitz)
+
+ This allows you, in your step matcher, to say something like:
+ maillbox_for(some_user)
+
+ Use it in your cucumber env.rb like so:
+
+ EmailSpec::AddressConverter.instance.conversion do |input|
+ if input.is_a?(User)
+ input.email
+ else
+ input
+ end
+ end
+
+=== Bufixes
+ * Revert parse_email_for_link helper method to allow for text links as well as explicit link finding. (Mischa Fierer)
+ * Isolated variances between using email-spec with an ARMailer project. (Luke Melia)
+
+
+== 0.0.9 2009-2-15
+ === New features
+ * have_body_text, have_header matchers (Luke Melia)
+ * EmailViewer - opens all sent emails in a given scenario when the environment variables are set. (Luke Melia)
+ * Added compatibility with using ARMailer in test mode. (Luke Melia)
+ === Bugfixes
+ * set_current_email now works with multiple addresses in To field. (Brian McManus, Ben Mabey)
+
+== 0.0.7 2009-1-20
+ === New features
+ * have_subject matcher (Ben Mabey)
+
+== 0.0.6 2008-12-23
+ === New features
+ * Improved RSpec documentation and refactorings. (Ben Mabey)
+ === Bugfixes
+ * Removed sample app Rake Tasks to have it play nice with environments that use Cucumber as plugin- not gem. (Ben Mabey, Ivor- on github)
+
+== 0.0.5 2008-12-18
+ * Initial release - see this post for full history and contributors: http://www.benmabey.com/2008/12/18/github-rocks/
@@ -0,0 +1,19 @@
+Copyright (c) 2008-2009 Ben Mabey
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,125 @@
+= Email Spec
+
+A collection of RSpec matchers and Cucumber steps to make testing emails go smoothly.
+
+
+== Setup
+
+ script/plugin install git://github.com/bmabey/email-spec.git
+
+=== Gem Setup
+
+ gem install bmabey-email_spec
+
+ # config/environments/test.rb
+ config.gem 'bmabey-email_spec', :lib => 'email_spec'
+
+=== Cucumber
+
+To use the steps in features put the following in your env.rb:
+
+ # Make sure this require is after you require cucumber/rails/world.
+ require 'email_spec/cucumber'
+
+This will load all the helpers that the steps rely on.
+It will also add a Before hook for Cucumber so that emails are cleared at the start of each scenario.
+
+Then:
+
+ script/generate email_spec
+
+This will give you a bunch of steps to get started with in step_definitions/email_steps.rb
+
+=== RSpec
+
+ First you need to require the helpers and matchers in your spec_helper.rb like so:
+
+ require "email_spec/helpers"
+ require "email_spec/matchers"
+
+ You will then need to include EmailSpec::Helpers and EmailSpec::Matchers in your example groups.
+ 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:
+
+ Spec::Runner.configure do |config|
+ config.include(EmailSpec::Helpers)
+ config.include(EmailSpec::Matchers)
+ end
+
+ Otherwise, you will need to include them in the example groups you wish to use them:
+
+ describe "Signup Email" do
+ include EmailSpec::Helpers
+ include EmailSpec::Matchers
+ ...
+ end
+
+== Usage
+
+=== Cucumber
+
+ Scenario: A new person signs up
+ Given I am at "/"
+ When I fill in "Email" with "quentin@example.com"
+ And I press "Sign up"
+ And I should receive an email
+ When I open the email
+ Then I should see "confirm" in the email
+ When I follow "confirm" in the email
+ Then I should see "Confirm your new account"
+
+For more examples, check out examples/rails_root in the source for a small example app that implements these steps.
+
+=== RSpec
+
+ ==== Testing In Isolation ====
+ 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:
+
+ Verify that the mailer is used correctly in the controller (this would apply to a model as well):
+
+ describe "POST /signup (#signup)" do
+ it "should deliver the signup email" do
+ # expect
+ UserMailer.should_receive(:deliver_signup).with("email@example.com", "Jimmy Bean")
+ # when
+ post :signup, "Email" => "email@example.com", "Name" => "Jimmy Bean"
+ end
+ end
+
+ Examples for the #signup method in UserMailer:
+
+ describe "Signup Email" do
+ include EmailSpec::Helpers
+ include EmailSpec::Matchers
+ include ActionController::UrlWriter
+
+ before(:all) do
+ @email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks")
+ end
+
+ it "should be set to be delivered to the email passed in" do
+ @email.should deliver_to("jojo@yahoo.com")
+ end
+
+ it "should contain the user's message in the mail body" do
+ @email.should have_text(/Jojo Binks/)
+ end
+
+ it "should contain a link to the confirmation link" do
+ @email.should have_text(/#{confirm_account_url}/)
+ end
+
+ it "should have the correct subject" do
+ @email.should have_subject(/Account confirmation/)
+ end
+
+ end
+
+ ==== Using the helpers when not testing in isolation ====
+
+ Don't. :) Seriously, if you do just take a look at the helpers and use them as you wish.
+
+== Original Authors
+
+Ben Mabey, Aaron Gibralter, Mischa Fierer
+
+Please see History.txt for upcoming changsets and other contributors.
@@ -0,0 +1,51 @@
+require 'rubygems'
+require 'spec/rake/spectask'
+
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |s|
+ s.name = "email_spec"
+ s.platform = Gem::Platform::RUBY
+ s.authors = ['Ben Mabey', 'Aaron Gibralter', 'Mischa Fierer']
+ s.email = "ben@benmabey.com"
+ s.homepage = "http://github.com/bmabey/email-spec/"
+ s.summary = "Easily test email in rspec and cucumber"
+ s.bindir = "bin"
+ s.description = s.summary
+ s.require_path = "lib"
+ s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["rails_generators/**/*"] + Dir["spec/**/*"] + Dir["examples/**/*"]
+ # rdoc
+ s.has_rdoc = true
+ s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
+ s.rubyforge_project = 'email-spec'
+ end
+rescue LoadError
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
+end
+
+begin
+ require 'cucumber/rake/task'
+ Cucumber::Rake::Task.new(:features)
+rescue LoadError
+ task :features do
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
+ end
+end
+
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new(:spec) do |spec|
+ spec.libs << 'lib' << 'spec'
+ spec.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+namespace :example_app do
+ Spec::Rake::SpecTask.new(:spec) do |spec|
+ desc "Specs for Example app"
+ spec.libs << 'lib' << 'spec'
+ spec.spec_files = FileList['examples/rails_root/spec/**/*_spec.rb']
+ end
+end
+
+task :default => [:features, :spec, 'example_app:spec']
+
@@ -0,0 +1,4 @@
+---
+:patch: 0
+:major: 0
+:minor: 2
Oops, something went wrong.

0 comments on commit 1f01fd1

Please sign in to comment.