Sha256: 17309dc26a8dc8f750c8adf24e210247288c40c5745469ab7fbc7c9b21db909e

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'
require 'fist_of_fury/api_sharedspec'

describe FistOfFury do
  it_should_behave_like 'the api'

  describe '#logger' do
    before :each do
      FistOfFury.logger = nil
    end

    it "delegates to Sucker Punch's logger" do
      expect(FistOfFury.logger).to eq SuckerPunch.logger
    end

    after :each do
      FistOfFury.logger = Logger.new(nil)
    end
  end

  describe '#clock' do
    it "delegates to the supervisor's clock" do
      expect(FistOfFury::Supervisor).to receive(:clock)
      FistOfFury.clock
    end
  end

  describe '#store' do
    it 'starts out as an empty hash' do
      expect(FistOfFury.store).to eq Hash.new
    end
  end

  describe '#dispatcher' do
    it "delegates to the supervisor's dispatcher" do
      expect(FistOfFury::Supervisor).to receive(:dispatcher)
      FistOfFury.dispatcher
    end
  end

  describe '#attack!' do
    it 'calls the block when provided' do
      allow(FistOfFury::Supervisor).to receive(:run!)
      block_called = false
      FistOfFury.attack! { block_called = true }
      expect(block_called).to eq true
    end

    it 'calls #run! on the supervisor' do
      expect(FistOfFury::Supervisor).to receive(:run!)
      FistOfFury.attack!
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fist_of_fury-0.2.7 spec/fist_of_fury_spec.rb
fist_of_fury-0.2.6 spec/fist_of_fury_spec.rb