Sha256: 04b1375037a6326ed8f0bffbcb5216672a92283bdf11b0372fec67124e2e7a62

Contents?: true

Size: 1.35 KB

Versions: 30

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

# Generators are not automatically loaded by Rails
require 'generators/rspec/view/view_generator'

describe Rspec::Generators::ViewGenerator 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 'with default template engine' do
    it 'generates a spec for the supplied action' do
      run_generator %w(posts index)
      file('spec/views/posts/index.html.erb_spec.rb').tap do |f|
        f.should contain(/require 'spec_helper'/)
        f.should contain(/describe "posts\/index"/)
      end
    end

    describe 'with a nested resource' do
      it 'generates a spec for the supplied action' do
        run_generator %w(admin/posts index)
        file('spec/views/admin/posts/index.html.erb_spec.rb').tap do |f|
          f.should contain(/require 'spec_helper'/)
          f.should contain(/describe "admin\/posts\/index"/)
        end
      end
    end
  end

  describe 'with a specified template engine' do
    it 'generates a spec for the supplied action' do
      run_generator %w(posts index --template_engine haml)
      file('spec/views/posts/index.html.haml_spec.rb').tap do |f|
        f.should contain(/require 'spec_helper'/)
        f.should contain(/describe "posts\/index"/)
      end
    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/view/view_generator_spec.rb
rspec-rails-2.14.1 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-3.0.0.beta1 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.99.0.beta1 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.14.0 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.13.1 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.13.0 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.12.2 spec/generators/rspec/view/view_generator_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.12.1 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.12.0 spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.11.4 spec/generators/rspec/view/view_generator_spec.rb
gem_repackager-0.1.0 support/gems/rspec-rails-2.11.0/spec/generators/rspec/view/view_generator_spec.rb
rspec-rails-2.11.0 spec/generators/rspec/view/view_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/view/view_generator_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/view/view_generator_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/view/view_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/view/view_generator_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/generators/rspec/view/view_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/view/view_generator_spec.rb