spec/lib/roadie/rails/automatic_spec.rb in roadie-rails-1.0.1 vs spec/lib/roadie/rails/automatic_spec.rb in roadie-rails-1.0.2

- old
+ new

@@ -25,19 +25,29 @@ end end describe "#mail" do let(:email) { Mail.new(to: "foo@example.com", from: "me@example.com") } - let(:roadie_options) { Options.new(url_options: {host: "somehost.com"}) } let(:instance) { some_mailer.new(email) } - before { allow(instance).to receive(:roadie_options).and_return roadie_options } - it "extends the email with InlineOnDelivery and assigns roadie options" do + options = Options.new(url_options: {host: "somehost.com"}) + allow(instance).to receive(:roadie_options).and_return options + email = instance.mail + expect(email).to be_kind_of(InlineOnDelivery) expect(email.roadie_options).not_to be_nil - expect(email.roadie_options.url_options).to eq roadie_options.url_options + expect(email.roadie_options.url_options).to eq options.url_options + end + + it "assigns nil roadie options if no options are present" do + allow(instance).to receive(:roadie_options).and_return nil + + email = instance.mail + + expect(email).to be_kind_of(InlineOnDelivery) + expect(email.roadie_options).to be_nil end end end end end