Sha256: 9a82a903f1a955677db9a2617749a82915fe6b48f126ce95550cb4326ab8b05d

Contents?: true

Size: 960 Bytes

Versions: 10

Compression:

Stored size: 960 Bytes

Contents

require "spec_helper"
require "support/generators_shared_examples"
require "generators/statesman/active_record_transition_generator"

describe Statesman::ActiveRecordTransitionGenerator, type: :generator do
  it_behaves_like "a generator" do
    let(:migration_name) { 'db/migrate/create_bacon_transitions.rb' }
  end

  describe 'properly adds class names' do
    before { run_generator %w(Yummy::Bacon Yummy::BaconTransition) }
    subject { file('app/models/yummy/bacon_transition.rb') }

    it { is_expected.to contain(/:bacon_transition/) }
    it { is_expected.not_to contain(%r{:yummy/bacon}) }
    it { is_expected.to contain(/class_name: 'Yummy::Bacon'/) }
  end

  describe 'properly formats without class names' do
    before { run_generator %w(Bacon BaconTransition) }
    subject { file('app/models/bacon_transition.rb') }

    it { is_expected.not_to contain(/class_name:/) }
    it { is_expected.to contain(/class BaconTransition/) }
  end
end

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/statesman-1.3.1/spec/generators/statesman/active_record_transition_generator_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/statesman-2.0.1/spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-2.0.1 spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-2.0.0 spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-2.0.0.rc1 spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-1.3.1 spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-1.3.0 spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-1.2.5 spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-1.2.4 spec/generators/statesman/active_record_transition_generator_spec.rb
statesman-1.2.3 spec/generators/statesman/active_record_transition_generator_spec.rb