Sha256: 7791f963c078ac4b5c4686ce91c69a1eb7480f6419811be35ce8f73ac573ee87

Contents?: true

Size: 1.29 KB

Versions: 30

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

begin
  require 'generator_spec'
rescue LoadError
end

require 'generators/rollbar/rollbar_generator'

describe Rollbar::Generators::RollbarGenerator, :type => :generator do
  destination File.expand_path('../../../tmp', __FILE__)

  before { prepare_destination }

  context 'with no arguments' do
    before do
      run_generator
    end

    it 'outputs a help message and generates Rollbar initializer with ENV' do
      expect(destination_root).to have_structure {
        directory 'config' do
          directory 'initializers' do
            file 'rollbar.rb' do
              contains "config.access_token = ENV\['ROLLBAR_ACCESS_TOKEN'\]"
            end
          end
        end
      }
    end
  end

  context 'with arguments' do
    before do
      run_generator(%w(aaaabbbbccccddddeeeeffff00001111))
    end

    it 'generates a Rollbar initializer with access token' do
      expect(destination_root).to have_structure {
        directory 'config' do
          directory 'initializers' do
            file 'rollbar.rb' do
              contains 'aaaabbbbccccddddeeeeffff00001111'
              contains "config.access_token = 'aaaabbbbccccddddeeeeffff00001111'"
            end
          end
        end
      }
    end
  end
end unless Rails::VERSION::STRING.start_with?('3.0')

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rollbar-2.18.2 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.18.0 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.17.0 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.16.4 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.16.3 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.16.2 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.16.0 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.15.6 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.15.5 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.15.4 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.15.3 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.15.2 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.15.1 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.15.0 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.14.1 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.14.0 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.13.3 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.13.2 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.13.1 spec/generators/rollbar/rollbar_generator_spec.rb
rollbar-2.13.0 spec/generators/rollbar/rollbar_generator_spec.rb