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