Sha256: 62621b4f5efe00a0dc31b9d663f1a5b03cfb3c0cff07c5d3b9f067b2fa89a7fb

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

require 'spec_helper'

describe DispatchRider::NotificationServices::FileSystem::Channel do

  let(:path) { File.expand_path("tmp/test/channel") }
  let(:published_message) { File.new(Dir["#{path}/*.ready"].first).read }

  before { FileUtils.mkdir_p(path) }
  after { FileUtils.rm_rf(path) }

  subject { described_class.new(path) }

  describe "#publish" do
    let(:message){ {:subject => "foo", :body => "bar"}.to_json }

    it "adds a file to the path folder" do
      expect {
        subject.publish(message)
      }.to change { Dir["#{path}/*"].length }.by(1)
    end

    it "writes the message to the file" do
      subject.publish(message)

      published_message.should == message
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dispatch-rider-1.5.3 spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb
dispatch-rider-1.5.2 spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb
dispatch-rider-1.5.1 spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb
dispatch-rider-1.5.0 spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb
dispatch-rider-1.4.2 spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb