Sha256: 31be544ba0a90d24692cdc1de0446b58693c96ce19cfca140c8e2efbb4cd61db

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

shared_examples "State Machine updateable event (concerns)" do
  unless described_class.method_defined? :blah
    described_class.class_eval do
      state_machine :state, initial: :pending do
        state :pending, :blahhed

        event :blah do
          transition any => :blahhed
        end
      end
    end
  end

  subject { described_class.new }
  it { should respond_to :event= }

  describe "#event=" do
    it "should not trigger non-existing state machine event" do
      subject.should_receive(:blah!)
      subject.event = :blah
      subject.blahhed?
    end

    it "should trigger state machine event" do
      subject.should_not_receive(:noblah!)
      subject.event = :noblah
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
applicants-0.11.0 spec/shared/concerns/state_machine/updateable_event.rb