Sha256: d0e94c560714ca5d34f76f8952660e315755d365b1da96064f101547b03c0724

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

require 'spec_helper'

describe Grape::Roar do
  subject do
    Class.new(Grape::API)
  end

  before do
    subject.format :json
    subject.formatter :json, Grape::Formatter::Roar
  end

  def app
    subject
  end

  context 'representer' do
    before do
      subject.get('/article/:id') do
        Article.new(title: 'Lonestar', id: params[:id])
      end
    end

    it 'returns a hypermedia representation' do
      get '/article/666'
      expect(last_response.body).to eq '{"title":"Lonestar","id":"666","links":[{"rel":"self","href":"/article/666"}]}'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
grape-roar-0.4.0 spec/representer_spec.rb
grape-roar-0.3.0 spec/representer_spec.rb
grape-roar-0.2.0 spec/representer_spec.rb
grape-roar-0.1.0 spec/representer_spec.rb