Sha256: ed13745a18099a5d9f6797144fbe8395e225727d7d1de59890ac84aaed02497e

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

shared_examples_for 'defining a model callback' do
  describe 'for a' do
    describe 'around_api_response' do
      it 'skips rendering if not yielded' do
        @luke.skip_api_response = true
        expect(@luke.as_api_response(:name_only).keys).to include(:skipped)
      end

      it 'renders if yielded' do
        expect(@luke.as_api_response(:name_only).keys).not_to include(:skipped)
      end
    end

    describe 'before_api_response' do
      it 'is called properly' do
        @luke.as_api_response(:name_only)
        expect(@luke.before_api_response_called?).to eql(true)
      end
    end

    describe 'after_api_response' do
      it 'is called properly' do
        @luke.as_api_response(:name_only)
        expect(@luke.after_api_response_called?).to eql(true)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_api-1.0.1 spec/support/model_examples/callbacks.rb
acts_as_api-1.0.0 spec/support/model_examples/callbacks.rb