Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

rails rspec test email sent

describe "User request update" do
  let(:user_one) { FactoryGirl.create(:user) }
  let(:user_two) { FactoryGirl.create(:user) }
  # let(:mail) { UserMailer.notify_users(user_one, user_two) } 

  # If your method sends two separate emails:
  it "#notify_users should notify both users" do
    UserMailer.notify_users(user_one, user_two)
    expect(ActionMailer::Base.deliveries.count).to eq(2)
    expect(ActionMailer::Base.deliveries[0].to).to include(user_one.email)
    expect(ActionMailer::Base.deliveries[1].to).to include(user_two.email)
  end

  # If your method sends a single email with both recipients
  it "#notify_users should notify both users" do
    UserMailer.notify_users(user_one, user_two)
    expect(ActionMailer::Base.deliveries.count).to eq(1)
    expect(ActionMailer::Base.deliveries.last.to).to include(user_one.email)
    expect(ActionMailer::Base.deliveries.last.to).to include(user_two.email)
  end
end
Comment

PREVIOUS NEXT
Code Example
Ruby :: Many to Many Active Record 
Ruby :: link_to 
Ruby :: rails group every 10 items in array 
Ruby :: ruby extract elements from array 
Ruby :: ruby * 
Ruby :: ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline. 
Ruby :: rails class sti reminders 
R :: how to create dates in a range in R 
R :: automatically wrap r text label ggplot 
R :: r remove rows where value is 0 
R :: i have library(dplyr) but i still get Error in select(., 
R :: how to transform days in years R 
R :: variable assignment in r 
R :: split strings by space in r 
R :: comments in r 
R :: ggplot2 multiple lines geom_line 
R :: skewness in r 
R :: r environment variables 
R :: R darekn color 
R :: plot porportion bar chart in r 
R :: R vector all but last 
R :: r remove regex from string 
R :: read.table tab separator 
R :: R view memory size of variables 
R :: R concaat string and number 
R :: excel date format r 
R :: Non-redundant version of expand.grid 
R :: chunk with multiple plot tabset 
Rust :: char byte size rust 
Rust :: how to create a vector in rust 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =