1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00
kaminari--kaminari/spec/spec_helper_for_sinatra.rb
Eito Katagiri 08e9e2ba18 fix build error in spec with sinatra
The error was 'NameError: uninitialized constant Kaminari::ActionViewExtension'.
2013-08-08 12:39:41 +09:00

34 lines
933 B
Ruby

require 'kaminari/sinatra'
require 'kaminari/helpers/action_view_extension'
require 'rack/test'
require 'sinatra/test_helpers'
require 'capybara/rspec'
require 'fake_app/sinatra_app'
Capybara.app = SinatraApp
module HelperMethodForHelperSpec
module FakeEnv
def env
{'PATH_INFO' => '/'}
end
end
def helper
# OMG terrible object...
::Kaminari::Helpers::SinatraHelpers::ActionViewTemplateProxy.new(:current_params => {}, :current_path => '/', :param_name => Kaminari.config.param_name).extend(Padrino::Helpers, Kaminari::ActionViewExtension, Kaminari::Helpers::SinatraHelpers::HelperMethods, FakeEnv)
end
end
RSpec.configure do |config|
config.include Rack::Test::Methods
config.include Sinatra::TestHelpers
config.include HelperMethodForHelperSpec
# config.include HelperMethodForHelperSpec, :type => :helper
end
require 'nokogiri'
def last_document
Nokogiri::HTML(last_response.body)
end