Sha256: 5fc1a095539c2da3b16cecdbc6a92f367c757b4d141da433ba84668c67cff728

Contents?: true

Size: 968 Bytes

Versions: 1

Compression:

Stored size: 968 Bytes

Contents

require "spec_helper"

module Ammeter::RSpec::Rails
  describe GeneratorExampleGroup do
    it { should be_included_in_files_in('./spec/generators/') }
    it { should be_included_in_files_in('.\\spec\\generators\\') }

    let(:group) do
      ::RSpec::Core::ExampleGroup.describe do
        include GeneratorExampleGroup
      end
    end

    it "adds :type => :generator to the metadata" do
      group.metadata[:type].should eq(:generator)
    end

    context "with implicit subject" do
      it "uses the generator as the subject" do
        generator = double('generator')
        example = group.new
        example.stub(:generator => generator)
        example.subject.should == generator
      end
    end

    describe "with explicit subject" do
      it "should use the specified subject instead of the generator" do
        group.subject { 'explicit' }
        example = group.new
        example.subject.should == 'explicit'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ammeter-0.1.0 spec/ammeter/rspec/rails/generator/example/generator_example_group_spec.rb