Sha256: a7f67345e7fe441f7c577ea15d5b488ce15ebdda4d9cbd087827daec378f0ff7
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
# encoding: utf-8 describe Informator::Event do subject(:event) { described_class.new type, :foo, [:bar], baz: :qux } let(:type) { "success" } describe ".new" do it { is_expected.to be_frozen } end # describe .new describe ".[]" do before { allow(described_class).to receive(:new) } it "builds the event" do expect(described_class).to receive(:new).with(:foo, :bar, :baz) described_class[:foo, :bar, :baz] end end # describe .new describe "#type" do subject { event.type } it { is_expected.to eql type.to_sym } end # describe #type describe "#messages" do subject { event.messages } it { is_expected.to eql %w(foo bar) } end # describe #messages describe "#data" do subject { event.data } it { is_expected.to eq(baz: :qux) } end # describe #data describe "#==" do subject { event == other } context "to event with the same type and data" do let(:other) { Class.new(described_class).new type, baz: :qux } it { is_expected.to eql true } end # context context "to event with another type" do let(:other) { described_class.new :error, baz: :qux } it { is_expected.to eql false } end # context context "to event with other data" do let(:other) { described_class.new :success, baz: "qux" } it { is_expected.to eql false } end # context context "to non-event" do let(:other) { :foo } it { is_expected.to eql false } end # context end # describe #== end # describe Informator::Event
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
informator-0.0.2 | spec/unit/informator/event_spec.rb |