Sha256: 58bb850276dd8abb00f79384fcb255875b1fdaa36af0e73ba534e23b70987c0f

Contents?: true

Size: 1.49 KB

Versions: 9

Compression:

Stored size: 1.49 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Tekeya" do
  describe "Notification" do
    before :each do
      @user = Fabricate(:user)
      @user1 = Fabricate(:user)
    end

    describe "DSL" do
      before :each do
        @user1.track @user
        @user.notifications.poked_by @user1

        @user2 = Fabricate(:user)
        @user3 = Fabricate(:user)
        @user4 = Fabricate(:user)

        @status = Fabricate(:status)
      end

      it "should notify the entity with the proper notification data" do
        tracked_notification = @user.notifications.first

        tracked_notification.notification_type.should == "tracked_by"
        tracked_notification.subject.should == @user
        tracked_notification.actors.map(&:attachable_id).include?(@user1.id).should == true

        poked_notification = @user.notifications.last

        poked_notification.notification_type.should == "poked_by"
        poked_notification.subject.should == @user
        poked_notification.actors.map(&:attachable_id).include?(@user1.id).should == true
      end

      it "should notify multiple entities" do
        Tekeya::Notification.notify! [@user2, @user3, @user4], :posted, @status, @user

        ((@user2.notifications == @user3.notifications) == (@user4.notifications == 1)).should == true
      end

      it "should return unread notifications correctly" do
        @user.notifications.first.read!
        @user.notifications.unread.count.should == 1
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tekeya-0.0.10 spec/tekeya/notification_spec.rb
tekeya-0.0.9 spec/tekeya/notification_spec.rb
tekeya-0.0.7 spec/tekeya/notification_spec.rb
tekeya-0.0.6 spec/tekeya/notification_spec.rb
tekeya-0.0.5 spec/tekeya/notification_spec.rb
tekeya-0.0.4 spec/tekeya/notification_spec.rb
tekeya-0.0.3 spec/tekeya/notification_spec.rb
tekeya-0.0.2 spec/tekeya/notification_spec.rb
tekeya-0.0.1 spec/tekeya/notification_spec.rb