Sha256: e3ed85bdb18ae9ae450161f0a7830ad9cd30621a93e62e5853197851bb4d1a42

Contents?: true

Size: 550 Bytes

Versions: 3

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).to_a
    @artists.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

3 entries across 3 versions & 1 rubygems

Version Path
rack-reducer-1.0.0 spec/sinatra_functional_spec.rb
rack-reducer-0.1.2 spec/sinatra_functional_spec.rb
rack-reducer-0.1.1 spec/sinatra_functional_spec.rb