Sha256: 666bc90159f694739a0d281910845d6afad8ae2607a1b534abb44c9fddf78a56
Contents?: true
Size: 797 Bytes
Versions: 3
Compression:
Stored size: 797 Bytes
Contents
require 'spec_helper' describe 'Grape::Rabl partials' do let(:parsed_response) { JSON.parse(last_response.body) } subject do Class.new(Grape::API) end before do subject.format :json subject.formatter :json, Grape::Formatter::Rabl subject.before { env['api.tilt.root'] = "#{File.dirname(__FILE__)}/views" } end def app subject end it 'proper render partials' do subject.get('/home', rabl: 'project') do @author = OpenStruct.new(author: 'LTe') @type = OpenStruct.new(type: 'paper') @project = OpenStruct.new(name: 'First', type: @type, author: @author) end get('/home') expect(parsed_response).to eq( JSON.parse('{"project":{"name":"First","info":{"type":"paper"},"author":{"author":"LTe"}}}') ) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grape-rabl-0.5.0 | spec/grape_rabl_partials_spec.rb |
grape-rabl-0.4.3 | spec/grape_rabl_partials_spec.rb |
grape-rabl-0.4.2 | spec/grape_rabl_partials_spec.rb |