Sha256: a292f11fc59f7c02ed737ec74602019532cc0641144c05cfb1dbf7a9e282ff49

Contents?: true

Size: 1012 Bytes

Versions: 23

Compression:

Stored size: 1012 Bytes

Contents

require 'spec_helper'

describe 'Custom AASM::Base' do
  context 'when aasm_with invoked with SimpleCustomExample' do
    let(:simple_custom) { SimpleCustomExample.new }

    subject do
      simple_custom.fill_out!
      simple_custom.authorise
    end

    it 'has invoked authorizable?' do
      expect { subject }.to change { simple_custom.authorizable_called }.from(nil).to(true)
    end

    it 'has invoked fillable?' do
      expect { subject }.to change { simple_custom.fillable_called }.from(nil).to(true)
    end

    it 'has two transition counts' do
      expect { subject }.to change { simple_custom.transition_count }.from(nil).to(2)
    end
  end

  context 'when aasm_with invoked with non AASM::Base' do
    subject do
      Class.new do
        include AASM

        aasm :with_klass => String do
        end
      end
    end

    it 'should raise an ArgumentError' do
      expect { subject }.to raise_error(ArgumentError, 'The class String must inherit from AASM::Base!')
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
aasm-5.3.1 spec/unit/simple_custom_example_spec.rb
aasm-5.3.0 spec/unit/simple_custom_example_spec.rb
aasm-5.2.0 spec/unit/simple_custom_example_spec.rb
aasm-5.1.1 spec/unit/simple_custom_example_spec.rb
aasm-5.1.0 spec/unit/simple_custom_example_spec.rb
aasm-5.0.8 spec/unit/simple_custom_example_spec.rb
aasm-5.0.7 spec/unit/simple_custom_example_spec.rb
aasm-5.0.6 spec/unit/simple_custom_example_spec.rb
aasm-5.0.5 spec/unit/simple_custom_example_spec.rb
aasm-5.0.4 spec/unit/simple_custom_example_spec.rb
aasm-5.0.3 spec/unit/simple_custom_example_spec.rb
aasm-5.0.2 spec/unit/simple_custom_example_spec.rb
aasm-5.0.1 spec/unit/simple_custom_example_spec.rb
aasm-5.0.0 spec/unit/simple_custom_example_spec.rb
aasm-4.12.3 spec/unit/simple_custom_example_spec.rb
aasm-4.12.2 spec/unit/simple_custom_example_spec.rb
aasm-4.12.1 spec/unit/simple_custom_example_spec.rb
aasm-4.12.0 spec/unit/simple_custom_example_spec.rb
aasm-4.11.1 spec/unit/simple_custom_example_spec.rb
aasm-4.11.0 spec/unit/simple_custom_example_spec.rb