Sha256: 8cd67c56201e42d02c401c8a3bedc2acd8097345ec74a92ffff9e2a1d7fe72f9

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

shared_examples_for :notifier do
  let(:test_class_name) { described_class.to_s.underscore.split('/').last.to_sym }
  let(:test_instance) { create(test_class_name) }

  describe "with association" do
    it "has many sent_notifications" do
      notification_1 = create(:notification, notifier: test_instance)
      notification_2 = create(:notification, notifier: test_instance)
      expect(test_instance.sent_notifications.count).to    eq(2)
      expect(test_instance.sent_notifications.earliest).to eq(notification_1)
      expect(test_instance.sent_notifications.latest).to   eq(notification_2)
    end
  end    

  describe "as public class methods" do
    describe ".available_as_notifier?" do
      it "returns true" do
        expect(described_class.available_as_notifier?).to be_truthy
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activity_notification-0.0.10 spec/concerns/models/notifier_spec.rb