Sha256: 57ee0c7004ccda1c655cff430ab78fb85d5db6dbea4ae78c30dd4071a46b6e24

Contents?: true

Size: 589 Bytes

Versions: 5

Compression:

Stored size: 589 Bytes

Contents

require 'rails_helper'

RSpec.describe Post, type: :model do

  let(:post) { create(:post) }

  context 'creates a notification that' do
    let(:post) { create(:post, :state => :draft) }
    it 'does not create a notification on create' do
      post
      expect(notification_count).to eq(0)
    end
    it 'does not create a notification when changing to "pending"' do
      post.pending!
      expect(notification_count).to eq(0)
    end
    it 'creates a notification when changing to "published"' do
      post.published!
      expect(notification_count).to eq(1)
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
notify_on-1.0.5 spec/dummy/spec/models/post_spec.rb
notify_on-1.0.4 spec/dummy/spec/models/post_spec.rb
notify_on-1.0.3 spec/dummy/spec/models/post_spec.rb
notify_on-1.0.2 spec/dummy/spec/models/post_spec.rb
notify_on-1.0.1 spec/dummy/spec/models/post_spec.rb