Sha256: d1f516d225bccce3eb40947cf20d79e3aa61c500a2618349c4014505546f4dbe

Contents?: true

Size: 550 Bytes

Versions: 1

Compression:

Stored size: 550 Bytes

Contents

require 'spec_helper'
require 'sinatra/base'
require 'json'

class SinatraFunctional < Sinatra::Base
  class Artist < Sequel::Model
    plugin :json_serializer
  end

  get '/artists' do
    @artists = Rack::Reducer.call(params, SEQUEL_QUERY)
    @artists.to_a.to_json
  end
end

describe SinatraFunctional do
  let(:app) { described_class }
  it_behaves_like Rack::Reducer

  it 'applies a default order' do
    get '/artists' do |response|
      genre = JSON.parse(response.body)[0]['genre']
      expect(genre).to eq('alt-soul')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-reducer-1.0.1 spec/sinatra_functional_spec.rb