Sha256: 9001cc14788dc729e63ae25652f28b9b38f6eaf9539f575aacf1ebf271b97084

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'
require 'generators/rails_pages/scaffold/scaffold_generator'

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

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

    describe 'tests_controller.rb' do
      it 'should exist' do
        expect(File.exist? "#{destination}/app/controllers/tests_controller.rb").to be_true
      end
    end

    describe 'resources :tests' do
      it 'should be defined' do
        expect(File.read "#{destination}/config/routes.rb").to include('resources :tests')
      end
    end
  end

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

    describe 'tests_controller.rb' do
      it 'should not exist' do
        expect(File.exist? "#{destination}/app/controllers/tests_controller.rb").to be_false
      end
    end

    describe 'resources :tests' do
      it 'should not be defined' do
        expect(File.read "#{destination}/config/routes.rb").to_not include('resources :tests')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_pages-0.0.2 spec/integration/scaffold_generator_spec.rb
rails_pages-0.0.1 spec/integration/scaffold_generator_spec.rb