Sha256: 954a335585a58424d46ddbb889e367c453269a4a85015a6f688a126b590e6a11

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe AdamSignals::Response do
  let(:target_type)     { :xmpp }
  let(:target_address)  { 'foo@bar.com' }
  let(:body)            { 'Hello there' }

  subject { described_class.new target_type: target_type, target_address: target_address, body: body }

  its(:target_type)     { should == target_type }
  its(:target_address)  { should == target_address }
  its(:body)            { should == body }

  it "should be able to encode to and decode from JSON" do
    subject.should eql(described_class.from_json(subject.to_json))
  end

  describe "equality" do
    context "with no attributes set" do
      it "should be equal" do
        described_class.new.should eql(described_class.new)
      end
    end

    context "with attributes set the same" do
      it "should be equal" do
        described_class.new(target_type: :xmpp).should eql(described_class.new(target_type: :xmpp))
      end
    end

    context "with attributes set differently" do
      it "should be equal" do
        described_class.new(target_type: :email).should_not eql(described_class.new(target_type: :xmpp))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adam_signals-1.0.0 spec/adam_signals/response_spec.rb