Sha256: 8e6da96332f5a1d1edad0c66198d3309bd8bbe81bc6da8038d992291d96f3501

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

# Generators are not automatically loaded by Rails
require 'generators/rspec/integration/integration_generator'

describe Rspec::Generators::IntegrationGenerator 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 'are not generated' do
    before do
      run_generator %w(posts --no-request-specs)
    end
    describe 'index.html.erb' do
      subject { file('spec/requests/posts_spec.rb') }
      it { should_not exist }
    end
  end

  describe 'are generated' do
    describe 'without webrat matchers by default' do
      before do
        run_generator %w(posts)
      end
      subject { file('spec/requests/posts_spec.rb') }
      it { should exist }
      it { should contain /require 'spec_helper'/ }
      it { should contain /describe "GET \/posts"/ }
      it { should contain /get posts_index_path/ }
    end
    describe 'with webrat matchers' do
      before do
        run_generator %w(posts --webrat)
      end
      subject { file('spec/requests/posts_spec.rb') }
      it { should exist }
      it { should contain /require 'spec_helper'/ }
      it { should contain /describe "GET \/posts"/ }
      it { should contain /visit posts_index_path/ }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rspec-rails-2.8.1 spec/generators/rspec/integration/integration_generator_spec.rb
rspec-rails-2.8.0 spec/generators/rspec/integration/integration_generator_spec.rb
rspec-rails-2.8.0.rc2 spec/generators/rspec/integration/integration_generator_spec.rb
rspec-rails-2.8.0.rc1 spec/generators/rspec/integration/integration_generator_spec.rb
rspec-rails-2.7.0 spec/generators/rspec/integration/integration_generator_spec.rb
rspec-rails-2.7.0.rc1 spec/generators/rspec/integration/integration_generator_spec.rb