Merge branch 'separate_user_and_issue_observer_from_mail_observer' of https://github.com/robbkidd/gitlabhq into robbkidd-separate_user_and_issue_observer_from_mail_observer
This commit is contained in:
commit
55f8338502
19 changed files with 358 additions and 49 deletions
|
@ -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
|
||||
|
|
|
@ -41,16 +41,23 @@ describe "Admin::Users" do
|
|||
|
||||
it "should call send mail" do
|
||||
Notify.should_receive(:new_user_email).and_return(stub(:deliver => true))
|
||||
click_button "Save"
|
||||
|
||||
User.observers.enable :user_observer do
|
||||
click_button "Save"
|
||||
end
|
||||
end
|
||||
|
||||
it "should send valid email to user with email & password" do
|
||||
click_button "Save"
|
||||
user = User.last
|
||||
email = ActionMailer::Base.deliveries.last
|
||||
email.subject.should have_content("Account was created")
|
||||
email.body.should have_content(user.email)
|
||||
email.body.should have_content(@password)
|
||||
User.observers.enable :user_observer do
|
||||
with_resque do
|
||||
click_button "Save"
|
||||
end
|
||||
user = User.last
|
||||
email = ActionMailer::Base.deliveries.last
|
||||
email.subject.should have_content("Account was created")
|
||||
email.body.should have_content(user.email)
|
||||
email.body.should have_content(@password)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -128,16 +128,22 @@ describe "Issues" do
|
|||
end
|
||||
|
||||
it "should call send mail" do
|
||||
Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))
|
||||
click_button "Submit new issue"
|
||||
Issue.observers.enable :issue_observer do
|
||||
Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))
|
||||
click_button "Submit new issue"
|
||||
end
|
||||
end
|
||||
|
||||
it "should send valid email to user" do
|
||||
click_button "Submit new issue"
|
||||
issue = Issue.last
|
||||
email = ActionMailer::Base.deliveries.last
|
||||
email.subject.should have_content("New Issue was created")
|
||||
email.body.should have_content(issue.title)
|
||||
Issue.observers.enable :issue_observer do
|
||||
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")
|
||||
email.body.should have_content(issue.title)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue