Sha256: ecbcdd214864d1bda855fed896152d0385477bdb1555870efac01f726487d8d8

Contents?: true

Size: 1.43 KB

Versions: 30

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

# Generators are not automatically loaded by Rails
require 'generators/rspec/mailer/mailer_generator'

describe Rspec::Generators::MailerGenerator do
  # Tell the generator where to put its output (what it thinks of as Rails.root)
  destination File.expand_path("../../../../../tmp", __FILE__)

  before { prepare_destination }

  describe 'mailer spec' do
    subject { file('spec/mailers/posts_spec.rb') }
    describe 'a spec is created for each action' do
      before do
        run_generator %w(posts index show)
      end
      it { should exist }
      it { should contain(/require "spec_helper"/) }
      it { should contain(/describe "index" do/) }
      it { should contain(/describe "show" do/) }
    end
    describe 'creates placeholder when no actions specified' do
      before do
        run_generator %w(posts)
      end
      it { should exist }
      it { should contain(/require "spec_helper"/) }
      it { should contain(/pending "add some examples to \(or delete\)/) }
    end
  end

  describe 'a fixture is generated for each action' do
    before do
      run_generator %w(posts index show)
    end
    describe 'index' do
      subject { file('spec/fixtures/posts/index') }
      it { should exist }
      it { should contain(/Posts#index/) }
    end
    describe 'show' do
      subject { file('spec/fixtures/posts/show') }
      it { should exist }
      it { should contain(/Posts#show/) }
    end
  end
end

Version data entries

30 entries across 25 versions & 5 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-rails-2.13.0/spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.14.1 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-3.0.0.beta1 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.99.0.beta1 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.14.0 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.13.1 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.13.0 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.12.2 spec/generators/rspec/mailer/mailer_generator_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.12.1 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.12.0 spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.11.4 spec/generators/rspec/mailer/mailer_generator_spec.rb
gem_repackager-0.1.0 support/gems/rspec-rails-2.11.0/spec/generators/rspec/mailer/mailer_generator_spec.rb
rspec-rails-2.11.0 spec/generators/rspec/mailer/mailer_generator_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/mailer/mailer_generator_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/mailer/mailer_generator_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/mailer/mailer_generator_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/mailer/mailer_generator_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/mailer/mailer_generator_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/mailer/mailer_generator_spec.rb