Sha256: c8900e3e53613a2c53f496119587384c697851fca1e24792c077386e50c063c0

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module NotifyUser
  describe Houston do

    let(:user) { User.create({email: 'user@example.com' })}
    let(:notification) { NewPostNotification.create({target: user}) }

    before :each do
      allow_any_instance_of(BaseNotification).to receive(:mobile_message).and_return('New Notification')
      allow_any_instance_of(User).to receive(:devices).and_return(double('device'))
    end

    describe "initialisation" do
      it "should initialise the correct push options" do
        @houston = NotifyUser::Houston.new(notification, {})

        expect(@houston.push_options[:alert]).to eq 'New Notification'
        expect(@houston.push_options[:badge]).to eq 1
        expect(@houston.push_options[:category]).to eq 'NewPostNotification'
        expect(@houston.push_options[:custom_data]).to be_empty
        expect(@houston.push_options[:sound]).to eq 'default'
      end

      it "should access the notification targets list of devices" do
        expect(user).to receive(:devices)

        @houston = NotifyUser::Houston.new(notification, {})
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
notify_user-0.1.4 spec/models/notify_user/houston_spec.rb
notify_user-0.1.3 spec/models/notify_user/houston_spec.rb
notify_user-0.1.2 spec/models/notify_user/houston_spec.rb
notify_user-0.1.1 spec/models/notify_user/houston_spec.rb
notify_user-0.0.30 spec/models/notify_user/houston_spec.rb
notify_user-0.0.29 spec/models/notify_user/houston_spec.rb