Sha256: 5ebfdd5e65ac4ccd38189aa57920f688742b926acea7e0c095b11ef7dcfdf38e

Contents?: true

Size: 706 Bytes

Versions: 4

Compression:

Stored size: 706 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, 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, states: { :foo => :bar } } }

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
finite_machine-0.11.3 spec/unit/transition/inspect_spec.rb
finite_machine-0.11.2 spec/unit/transition/inspect_spec.rb
finite_machine-0.11.1 spec/unit/transition/inspect_spec.rb
finite_machine-0.11.0 spec/unit/transition/inspect_spec.rb