File: spec_helper.rb

package info (click to toggle)
ruby-api-pagination 4.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 272 kB
  • sloc: ruby: 1,125; makefile: 3
file content (41 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'support/numbers_controller'
require 'support/numbers_api'
require 'api-pagination'

ENV['PAGINATOR'] = 'kaminari'

if ENV['PAGINATOR'].nil?
  warn <<-WARNING
No PAGINATOR set. Defaulting to pagy.

To test against kaminari, run `PAGINATOR=kaminari bundle exec rspec`
To test against will_paginate, run `PAGINATOR=will_paginate bundle exec rspec`
WARNING

  ENV['PAGINATOR'] = 'pagy'
end

require ENV['PAGINATOR']
ApiPagination.config.paginator = ENV['PAGINATOR'].to_sym

require 'will_paginate/array' if ENV['PAGINATOR'].to_sym == :will_paginate

RSpec.configure do |config|
  config.include Rack::Test::Methods
  config.include ControllerExampleGroup, :type => :controller

  # Disable the 'should' syntax.
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = 'random'

  def app
    NumbersAPI
  end
end