Sha256: fb6ac490cb511f89b41756b9f217d5d369d4deb876edb7e69f35955771497823

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require "spec_helper"

describe Databox::Messages do

  let(:messages){ Databox::Messages.new("just_messages") }

  context "add messages" do
    it { expect(messages.name).to eq "just_messages" }

    it {
      expect { messages.add("Just message") }
      .to change { messages.list.size }.from(0).to(1)
    }


    context "save" do
      context "simple" do
        before {
          stub_request(:post, /push/)
          .to_return { request_from "simple_message" }
        }

        before { messages.add("I was here") }

        it {
          expect { messages.save }
          .to change { messages.list.size }.to(0)
        }
      end

      context "multiple" do
        before {
          stub_request(:post, /push/)
          .to_return { request_from "multiple_message" }
        }

        before do
          messages.add "I was here"
          messages.add "This is test"
        end

        it {
          expect { messages.save }
          .to change { messages.list.size }.to(0)
        }
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
databox-0.1.1 spec/databox/messages_spec.rb
databox-0.1.0 spec/databox/messages_spec.rb
databox-0.0.3 spec/databox/messages_spec.rb