Sha256: 316ad814f34562eba699a1bf9386071dc3d0c25c7dc9071f6fb5160dc506e203

Contents?: true

Size: 1.49 KB

Versions: 48

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'
require 'flydata-core/event/flydata_event'

module FlydataCore
  module Event
    describe  FlydataEvent do
      describe "#initialize" do
        let(:noun) { "test" }
        let(:verb) { "testing" }
        let(:data) { { 'tables' => %w(table_a table_b) } }

        context 'when all parameters are given' do
          let(:parameters) do
            { data_entry_id: 1,
              data_port_id: 2,
              data: data,
              id: 12,
              created: Time.now + 60, }
          end

          it 'sets given data to instance variables' do
            event = FlydataEvent.new(noun, verb, parameters)
            expect(event.noun).to eq(noun)
            expect(event.verb).to eq(verb)
            expect(event.data).to eq(data)
            expect(event.id).to eq(12)
            expect(event.data_entry_id).to eql(1)
            expect(event.data_port_id).to eql(2)
            expect(event.created).to be_kind_of(Time)
          end
        end

        context 'when parameters are empty' do
          it 'sets default or nil to instance variables' do
            event = FlydataEvent.new(noun, verb)
            expect(event.noun).to eq(noun)
            expect(event.verb).to eq(verb)
            expect(event.data).to be_nil
            expect(event.id).not_to be_nil
            expect(event.data_entry_id).to be_nil
            expect(event.data_port_id).to be_nil
            expect(event.created).not_to be_nil
          end
        end
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
flydata-0.8.10.2 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.10.1 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.9.11 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.10 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.9 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.8 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.7 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.6 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.5 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.4 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.3 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.2 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.1 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.8.0 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.7.19 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.7.18 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.7.17 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.7.16 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.7.15 flydata-core/spec/event/flydata_event_spec.rb
flydata-0.7.14 flydata-core/spec/event/flydata_event_spec.rb