Sha256: 39ac9e8860762c9b70b877f40fc9d8e8ff643f9d59000a69151cc25ed10f713d

Contents?: true

Size: 522 Bytes

Versions: 2

Compression:

Stored size: 522 Bytes

Contents

shared_examples_for 'calling a method in the api template' do
  subject(:response) { @luke.as_api_response(:only_full_name) }

  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(1).keys
  end

  it 'returns all specified fields by name' do
    expect(response.keys).to include(:full_name)
  end

  it 'returns the correct values for the specified fields' do
    expect(response.values).to include(@luke.full_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/methods.rb
acts_as_api-1.0.0 spec/support/model_examples/methods.rb