OSDN Git Service

Add resque_spec to test queuing mail.
authorRobb Kidd <robb@thekidds.org>
Mon, 21 May 2012 20:05:12 +0000 (16:05 -0400)
committerRobb Kidd <robb@thekidds.org>
Wed, 20 Jun 2012 18:09:46 +0000 (14:09 -0400)
Gemfile
Gemfile.lock
config/initializers/resque_mailer.rb [new file with mode: 0644]
spec/requests/admin/admin_projects_spec.rb
spec/requests/admin/admin_users_spec.rb
spec/requests/issues_spec.rb

diff --git a/Gemfile b/Gemfile
index 7208141..98168db 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -77,4 +77,5 @@ group :test do
   gem "simplecov", :require => false
   gem "shoulda-matchers"
   gem 'email_spec'
+  gem 'resque_spec'
 end
index bdf78c4..41cb556 100644 (file)
@@ -263,6 +263,9 @@ GEM
     resque_mailer (2.0.3)
       actionmailer (>= 3.0.0)
       resque (>= 1.2.3)
+    resque_spec (0.11.0)
+      resque (>= 1.19.0)
+      rspec (>= 2.5.0)
     rspec (2.10.0)
       rspec-core (~> 2.10.0)
       rspec-expectations (~> 2.10.0)
@@ -391,6 +394,7 @@ DEPENDENCIES
   redcarpet (~> 2.1.1)
   resque (~> 1.20.0)
   resque_mailer
+  resque_spec
   rspec-rails
   sass-rails (= 3.2.5)
   seed-fu
diff --git a/config/initializers/resque_mailer.rb b/config/initializers/resque_mailer.rb
new file mode 100644 (file)
index 0000000..cec9dec
--- /dev/null
@@ -0,0 +1 @@
+Resque::Mailer.excluded_environments = []
index 9a33c69..fb6577d 100644 (file)
@@ -88,6 +88,7 @@ describe "Admin::Projects" do
       fill_in 'Name', :with => 'NewProject'
       fill_in 'Code', :with => 'NPR'
       fill_in 'Path', :with => 'gitlabhq_1'
+      fill_in 'Description', :with => 'New Project Description'
       expect { click_button "Save" }.to change { Project.count }.by(1)
       @project = Project.last
     end
index 91082a6..c98ed2c 100644 (file)
@@ -45,7 +45,9 @@ describe "Admin::Users" do
     end
 
     it "should send valid email to user with email & password" do
-      click_button "Save"
+      with_resque do
+        click_button "Save"
+      end
       user = User.last
       email = ActionMailer::Base.deliveries.last
       email.subject.should have_content("Account was created")
index 5c59675..aa43b99 100644 (file)
@@ -133,7 +133,9 @@ describe "Issues" do
         end
 
         it "should send valid email to user" do
-          click_button "Submit new issue"
+          with_resque do
+            click_button "Submit new issue"
+          end
           issue = Issue.last
           email = ActionMailer::Base.deliveries.last
           email.subject.should have_content("New Issue was created")