Sha256: 3103da097e1221c342361b76a110f9b3d30d64b8a0046c4b082c1411b3d584b6

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'
require 'generators/rails_pages/resource_route/resource_route_generator'

describe RailsPages::Generators::ResourceRouteGenerator do
  destination = File.expand_path('../../dummy', __FILE__)

  context 'generate' do
    before(:all) do
      Dir.chdir(destination) { %x(rails generate rails_pages:resource_route test) }
    end

    describe 'resources :tests' do
      it 'should be defined' do
        expect(File.read "#{destination}/config/routes.rb").to include(
          "resources :tests, :only => :show, :format => false, :constraints => { :id => /.+?/ }"
        )
      end
    end
  end

  context 'destroy' do
    before(:all) do
      Dir.chdir(destination) { %x(rails destroy rails_pages:resource_route test) }
    end

    describe 'resources :tests' do
      it 'should not be defined' do
        expect(File.read "#{destination}/config/routes.rb").to_not include(
          "resources :tests, :only => :show, :format => false, :constraints => { :id => /.+?/ }"
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_pages-0.0.3 spec/integration/resource_route_generator_spec.rb
rails_pages-0.0.2 spec/integration/resource_route_generator_spec.rb
rails_pages-0.0.1 spec/integration/resource_route_generator_spec.rb