Sha256: 335996c859e1a252577b5d3a756f81db528995dc9b03e43e1e21ffd1f06e5609

Contents?: true

Size: 1.63 KB

Versions: 9

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'
require 'generators/genesis/install/install_generator'

shared_examples_for 'a genesis installation generator' do

  {
    'genesis.rake',         'lib/tasks/genesis.rake',
    'genesis_callbacks.rb', 'db/seeds/genesis_callbacks.rb'
  }.each do |src, dest|

    it "should generate the #{dest} file with the correct contents" do
      subject.should generate( dest ) { |content|
        content.should == File.read( File.join( source_root, src ) )
      }
    end

  end

end

describe Genesis::InstallGenerator do

  let :source_root do
    described_class.source_root
  end

  context "with no arguments or options" do

    it_should_behave_like 'a genesis installation generator'

    %w(
      db/seeds/production
      db/seeds/development
    ).each do |folder_path|

      it "should generate the #{folder_path} folder" do
        subject.should generate( folder_path )
      end

    end

  end


  with_args 'test1' do

    it_should_behave_like 'a genesis installation generator'

    it "should generate the db/seeds/test1 folder" do
      subject.should generate( 'db/seeds/test1' )
    end

  end

  with_args 'test1,test2' do

    it_should_behave_like 'a genesis installation generator'

    %w(
      db/seeds/test1
      db/seeds/test2
    ).each do |folder_path|

      it "should generate the #{folder_path} folder" do
        subject.should generate( folder_path )
      end

    end

  end

  with_args '--help' do

    it "should ouput the correct description in the help message" do
      subject.should output( "Description:\n  Installs the genesis assets necessary to create and execute seeds." )
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
genesis-1.10.0 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.9.0 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.8.2 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.8.1 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.8.0 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.7.0 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.6.0 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.5.0 spec/generators/genesis/install/install_generator_spec.rb
genesis-1.4.0 spec/generators/genesis/install/install_generator_spec.rb