and allow based syntax" do allow(message).to receive(:sent_at).and_return(Time.now) expect(message).to receive(:update_stats).with(:some, :args) expect(message.send_count).to eq(10) expect { message.deliver }.to_not raise_error end
them" do expect(user.paying_customer?).to be_truthy expect(user.price_plan).to be_truthy # only matches literal boolean values expect(user.paying_customer?).to be(true) end
@recipients.map(&:email) end end class MessageSender def initialize(message) @message = message end def deliver_message @message.emails.each do |email| deliver_to_email(email) end end def deliver_to_email(email) # snip end end
@recipients.map(&:email) end end class MessageSender def initialize(message) @message = message end def deliver_message @message.emails.each do |email| deliver_to_email(email) end end def deliver_to_email(email) # snip end end
app.create_user_and_message }.to change(User, :count).by(1) end it "creates a message" do expect { app.create_user_and_message }.to change(Message, :count).by(1) end