Sha256: f554f77ca80a40312e67ec803563f64f16af82c79235336129ae2f1c6b0dfd2d

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  context 'when inspecting' do
    let(:attrs) { {name: :start, parsed_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(:attrs) { {name: :start, parsed_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.10.2 spec/unit/transition/inspect_spec.rb
finite_machine-0.10.1 spec/unit/transition/inspect_spec.rb