Sha256: a071a2663c69dc4578b36bdd1a16553ed5a9148be4c178951957798b25285956

Contents?: true

Size: 1.03 KB

Versions: 11

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe PostMailer do
  describe "#decorated_email" do
    let(:email_body) { Capybara.string(email.body.to_s) }
    let(:email) { PostMailer.decorated_email(post).deliver }
    let(:post) { Post.create }

    it "decorates" do
      expect(email_body).to have_content "Today"
    end

    it "can use path helpers with a model" do
      expect(email_body).to have_css "#path_with_model", text: "/en/posts/#{post.id}"
    end

    it "can use path helpers with an id" do
      expect(email_body).to have_css "#path_with_id", text: "/en/posts/#{post.id}"
    end

    it "can use url helpers with a model" do
      expect(email_body).to have_css "#url_with_model", text: "http://www.example.com:12345/en/posts/#{post.id}"
    end

    it "can use url helpers with an id" do
      expect(email_body).to have_css "#url_with_id", text: "http://www.example.com:12345/en/posts/#{post.id}"
    end

    it "uses the correct view context controller" do
      expect(email_body).to have_css "#controller", text: "PostMailer"
    end
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
draper_new-3.0.0 spec/dummy/spec/mailers/post_mailer_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/draper-2.1.0/spec/dummy/spec/mailers/post_mailer_spec.rb
draper-2.1.0 spec/dummy/spec/mailers/post_mailer_spec.rb
draper-2.0.0 spec/dummy/spec/mailers/post_mailer_spec.rb
draper-1.4.0 spec/dummy/spec/mailers/post_mailer_spec.rb
draper-1.3.1 spec/dummy/spec/mailers/post_mailer_spec.rb
draper-1.3.0 spec/dummy/spec/mailers/post_mailer_spec.rb
draper-1.2.1 spec/dummy/spec/mailers/post_mailer_spec.rb
draper-1.2.0 spec/dummy/spec/mailers/post_mailer_spec.rb
jamesgolick-draper-1.1.1a spec/dummy/spec/mailers/post_mailer_spec.rb
draper-1.1.0 spec/dummy/spec/mailers/post_mailer_spec.rb