Sha256: 17adea36cd2a67e8672e1f604dc1f1cf6925f8858aef39ef7517d6d860fb6e99

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Redde::Generators::ScaffoldGenerator do
  include GeneratorSpec::TestCase
  destination File.expand_path('../../../tmp', __FILE__)
  arguments ['Articles']

  before(:all) do
    prepare_destination
    run_generator
  end

  after(:all) do
    FileUtils.rm_rf 'tmp'
  end

  let(:args) { ['ArticleCategory'] }
  let(:generator) { Redde::Generators::ScaffoldGenerator.new(args) }

  context 'METHODS' do
    it 'gets controller_routing_path' do
      expect(generator.send(:controller_routing_path)).to eq 'article_category'
    end

    it 'gets singular_controller_routing_path' do
      res = generator.send(:singular_controller_routing_path)
      expect(res).to eq 'article_category'
    end

    it 'gets model_name' do
      expect(generator.send(:model_name)).to eq '::ArticleCategory'
    end

    it 'gets plural_model_name' do
      expect(generator.send(:plural_model_name)).to eq '::ArticleCategories'
    end

    it 'gets resource_name' do
      expect(generator.send(:resource_name)).to eq 'article_category'
    end

    it 'gets plural_resource_name' do
      expect(generator.send(:plural_resource_name)).to eq 'article_categories'
    end

    it 'gets index header' do
      expect(generator.send(:index_header)).to eq 'Article categories'
    end
  end # end context 'METHODS'

  context 'INTEGRATION' do
    it 'Generates admin views' do
      assert_file 'app/views/admin/articles/index.html.haml'
      assert_file 'app/views/admin/articles/edit.html.haml'
    end

  end # end describe 'VIEWS'
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
redde-0.1.18 spec/generators/scaffold_generator_spec.rb
redde-0.1.17 spec/generators/scaffold_generator_spec.rb
redde-0.1.16 spec/generators/scaffold_generator_spec.rb
redde-0.1.15 spec/generators/scaffold_generator_spec.rb
redde-0.1.14 spec/generators/scaffold_generator_spec.rb
redde-0.1.13 spec/generators/scaffold_generator_spec.rb
redde-0.1.12 spec/generators/scaffold_generator_spec.rb
redde-0.1.11 spec/generators/scaffold_generator_spec.rb