Sha256: 9b3179f43de3902d53acf9987e4394765fc242d42bd8a5ab131a787986c63c75

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe FiniteMachine, '#respond_to' do

  subject(:fsm) {
    Car = Class.new do
      def engine_on?
        true
      end
    end
    FiniteMachine.new target: Car.new do
      initial :green

      events {
        event :slow,  :green  => :yellow
      }
    end
  }

  it "knows about event name" do
    expect(fsm).to respond_to(:slow)
  end

  it "doesn't know about not implemented call" do
    expect(fsm).not_to respond_to(:not_implemented)
  end

  it "knows about event callback" do
    expect(fsm).to respond_to(:on_enter_slow)
  end

  it "doesn't know about target class methods" do
    expect(fsm).not_to respond_to(:engine_on?)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
finite_machine-0.10.0 spec/unit/respond_to_spec.rb
finite_machine-0.9.2 spec/unit/respond_to_spec.rb
finite_machine-0.9.1 spec/unit/respond_to_spec.rb
finite_machine-0.9.0 spec/unit/respond_to_spec.rb