Sha256: 6cf0b9815242d2d7c18fe1e53075425b9936bf7b17ce60c252ae4885e6e25434

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

# Generators are not automatically loaded by Rails
require 'generators/draper/install/install_generator'

describe Draper::InstallGenerator 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 }

  context 'using rspec' do
    before { run_generator }

    shared_examples_for "ApplicationDecoratorGenerator" do
      describe 'app/decorators/application_decorator.rb' do
        subject { file('app/decorators/application_decorator.rb') }
        it { should exist }
        it { should contain "class ApplicationDecorator < Draper::Base" }
      end
    end

    describe 'spec/decorators/application_decorator_spec.rb' do
      subject { file('spec/decorators/application_decorator_spec.rb') }
      it { should exist }
      it { should contain "describe ApplicationDecorator do" }
    end
  end

  context "using test_unit" do
    before { run_generator ["", "-t=test_unit"]  }

    it_should_behave_like "ApplicationDecoratorGenerator"

    describe 'spec/decorators/application_decorator_spec.rb' do
      subject { file('spec/decorators/application_decorator_spec.rb') }
      it { should_not exist }
    end

    describe 'spec/decorators/application_decorator_test.rb' do
      subject { file('test/decorators/application_decorator_test.rb') }
      it { should exist }
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
draper-0.11.1 spec/generators/draper/install/install_generator_spec.rb
draper-0.11.0 spec/generators/draper/install/install_generator_spec.rb