Sha256: 6dd507426327ff2a07a6e5338f617044d0ecd6be94e623e8bbcd061575c036ef

Contents?: true

Size: 539 Bytes

Versions: 2

Compression:

Stored size: 539 Bytes

Contents

shared_examples_for 'listing attributes in the api template' do
  subject(:response) { @luke.as_api_response(:name_only) }

  it 'returns a hash' do
    expect(response).to be_kind_of(Hash)
  end

  it 'returns the correct number of fields' do
    expect(response).to have(2).keys
  end

  it 'returns the specified fields only' do
    expect(response.keys).to include(:first_name, :last_name)
  end

  it 'the specified fields have the correct value' do
    expect(response.values).to include(@luke.first_name, @luke.last_name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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