Sha256: 2a8cd29aba9a7004e66a08f39e7364e81f842fb5ea1681fab6d8259991e5251f

Contents?: true

Size: 871 Bytes

Versions: 10

Compression:

Stored size: 871 Bytes

Contents

require 'rails_helper'

describe BeaversController do

  describe 'POST create' do
    it 'publishes a create event' do
      expect{
        post :create, beaver: { name: 'beaver' }
      }.to publish_event('user_creates_beaver', { 'beaver_name' => 'beaver' })
    end
  end

  context 'for an existing beaver' do
    let(:beaver) { Beaver.create name: 'beaver' }

    describe 'PUT update' do
      it 'publishes an update event' do
        expect{
          put :update, id: beaver.id, beaver: { name: 'beaver_updated' }
        }.to publish_event('user_updates_beaver', { 'beaver_name' => 'beaver_updated' })
      end
    end

    describe 'DELETE destroy' do
      it 'publishes an delete event' do
        expect{
          delete :destroy, id: beaver.id
        }.to publish_event('user_deletes_beaver', { 'beaver_name' => 'beaver' })
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rabbit_feed-2.3.1 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-2.3.0 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-2.1.5 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-2.1.2 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-2.1.1 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-2.1.0 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-2.0.0 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-1.0.2 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-1.0.1 example/rails_app/spec/controllers/beavers_controller_spec.rb
rabbit_feed-1.0.0 example/rails_app/spec/controllers/beavers_controller_spec.rb