Sha256: 1f4fafc08d8298c073b78044ff8a4970aa13c67d3a3c6f15894e92d77e0f0cd5

Contents?: true

Size: 1.99 KB

Versions: 16

Compression:

Stored size: 1.99 KB

Contents

require 'spec_helper'

module Bullet
  module Notification
    describe Base do
      subject { Base.new(Post, [:comments, :votes]) }

      context "#title" do
        it "should raise NoMethodError" do
          lambda { subject.title }.should raise_error(NoMethodError)
        end
      end

      context "#body" do
        it "should raise NoMethodError" do
          lambda { subject.body }.should raise_error(NoMethodError)
        end
      end

      context "#whoami" do
        it "should display user name" do
          user = `whoami`.chomp
          subject.whoami.should == "user: #{user}"
        end
      end

      context "#body_with_caller" do
        it "should return body" do
          subject.stub(:body => "body")
          subject.body_with_caller.should == "body"
        end
      end

      context "#standard_notice" do
        it "should return title + body" do
          subject.stub(:title => "title", :body => "body")
          subject.standard_notice.should == "title\nbody"
        end
      end

      context "#full_notice" do
        it "should return whoami + url + title + body_with_caller" do
          subject.stub(:whoami => "whoami", :url => "url", :title => "title", :body_with_caller => "body_with_caller")
          subject.full_notice.should == "whoami\nurl\ntitle\nbody_with_caller"
        end
      end

      context "#notify_inline" do
        it "should send full_notice to notifier" do
          notifier = stub
          subject.stub(:notifier => notifier, :full_notice => "full_notice")
          notifier.should_receive(:inline_notify).with("full_notice")
          subject.notify_inline
        end
      end

      context "#notify_out_of_channel" do
        it "should send full_out_of_channel to notifier" do
          notifier = stub
          subject.stub(:notifier => notifier, :full_notice => "full_notice")
          notifier.should_receive(:out_of_channel_notify).with("full_notice")
          subject.notify_out_of_channel
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
bullet-4.6.0 spec/bullet/notification/base_spec.rb
bullet-4.5.0 spec/bullet/notification/base_spec.rb
bullet-4.4.0 spec/bullet/notification/base_spec.rb
bullet-4.3.1 spec/bullet/notification/base_spec.rb
bullet-4.3.0 spec/bullet/notification/base_spec.rb
bullet-4.2.0 spec/bullet/notification/base_spec.rb
bullet-4.1.6 spec/bullet/notification/base_spec.rb
bullet-4.1.5 spec/bullet/notification/base_spec.rb
bullet-4.1.4 spec/bullet/notification/base_spec.rb
bullet-4.1.3 spec/bullet/notification/base_spec.rb
bullet-4.1.2 spec/bullet/notification/base_spec.rb
bullet-4.1.1 spec/bullet/notification/base_spec.rb
bullet-4.1.0 spec/bullet/notification/base_spec.rb
bullet-4.0.0 spec/bullet/notification/base_spec.rb
bullet-2.3.1 spec/bullet/notification/base_spec.rb
bullet-2.3.0 spec/bullet/notification/base_spec.rb