Sha256: fec5d09bd94d5a4436dc09d64be1b354518c9b945c777d561115053b5f0de6d9

Contents?: true

Size: 745 Bytes

Versions: 2

Compression:

Stored size: 745 Bytes

Contents

# frozen_string_literal: true

RSpec.describe FiniteMachine::Transition, '#inspect' do
  let(:machine) { double(:machine) }

  subject(:transition) { described_class.new(machine, event_name, attrs) }

  context 'when inspecting' do
    let(:event_name) { :start }
    let(:attrs) { { states: { :foo => :bar, :baz => :daz } } }

    it "displays name and transitions" do
      expect(transition.inspect).to eql("<#FiniteMachine::Transition @name=start, @transitions=foo -> bar, baz -> daz, @when=[]>")
    end
  end

  context 'when converting to string' do
    let(:event_name) { :start }
    let(:attrs) { { states: { :foo => :bar } } }

    it "displays name and transitions" do
      expect(transition.to_s).to eql("start")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finite_machine-0.12.1 spec/unit/transition/inspect_spec.rb
finite_machine-0.12.0 spec/unit/transition/inspect_spec.rb