Sha256: a4142f3786f6c02e92ce129c3f25a3a87f678770f84ea4a1398d5611dcf550ce

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

require 'spec_helper'

describe Flirt::Callback do
    before(:each) do
        Flirt.enable
    end

    describe "when instantiated with an object and callback" do

        let(:listener) { Object.new }
        let(:callback_name) { :call_me }

        let(:callback) { Flirt::Callback.new object: listener, callback_name: callback_name }

        it "sets the object" do
            expect(callback.object).to eq(listener)
        end

        it "sets the callback" do
            expect(callback.callback_name).to eq(callback_name)
        end

        describe "when called" do

            let(:event_data) { {event: :data} }

            it "calls the callback with the event data" do
                expect(listener).to receive(callback_name).with(event_data)
                callback.call(event_data)
            end
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flirt-0.0.1 spec/flirt/flirt_callback_spec.rb