Sha256: ef854ade866f73e6613c174a1d2282f9ba3bc0f8cb2e12f31a5a8c70020d272e

Contents?: true

Size: 1.94 KB

Versions: 4

Compression:

Stored size: 1.94 KB

Contents

require "spec_helper"

class Bugsnag
  # mock Bugsnag
end

describe UniformNotifier::BugsnagNotifier do
  let(:notification_data) { {} }
  it "should not notify bugsnag" do
    Bugsnag.should_not_receive(:notify)
    UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
  end
  context "with string notification" do
    let(:notification_data) { {:user => 'user', :title => 'notify bugsnag', :url => 'URL', body: 'something'} }

    it "should notify bugsnag" do
      Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new(notification_data[:title]), :grouping_hash => notification_data[:body], :notification => notification_data)

      UniformNotifier.bugsnag = true
      UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
    end

    it "should notify bugsnag with option" do
      Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new(notification_data[:title]), :foo => :bar, :grouping_hash => notification_data[:body], :notification => notification_data)

      UniformNotifier.bugsnag = { :foo => :bar }
      UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
    end
  end
  context "with hash notification" do
    let(:notification_data) { "notify bugsnag" }

    it "should notify bugsnag" do
      Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new("notify bugsnag"), :grouping_hash => "notify bugsnag", :notification => {:title => "notify bugsnag"})

      UniformNotifier.bugsnag = true
      UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
    end

    it "should notify bugsnag with option" do
      Bugsnag.should_receive(:notify).with(UniformNotifier::Exception.new("notify bugsnag"), :foo => :bar, :grouping_hash => "notify bugsnag", :notification => {:title => "notify bugsnag"})

      UniformNotifier.bugsnag = { :foo => :bar }
      UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
uniform_notifier-1.8.0 spec/uniform_notifier/bugsnag_spec.rb
uniform_notifier-1.7.0 spec/uniform_notifier/bugsnag_spec.rb
uniform_notifier-1.6.2 spec/uniform_notifier/bugsnag_spec.rb
uniform_notifier-1.6.1 spec/uniform_notifier/bugsnag_spec.rb