2011-11-21 23:29:45 -05:00
|
|
|
require 'kaminari/sinatra'
|
2013-08-07 00:11:24 -04:00
|
|
|
require 'kaminari/helpers/action_view_extension'
|
2011-11-21 23:29:45 -05:00
|
|
|
require 'rack/test'
|
|
|
|
require 'sinatra/test_helpers'
|
2012-05-22 17:51:23 -04:00
|
|
|
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...
|
2013-08-07 00:11:24 -04:00
|
|
|
::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)
|
2012-05-22 17:51:23 -04:00
|
|
|
end
|
|
|
|
end
|
2011-11-21 23:29:45 -05:00
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include Rack::Test::Methods
|
|
|
|
config.include Sinatra::TestHelpers
|
2012-05-22 17:51:23 -04:00
|
|
|
config.include HelperMethodForHelperSpec
|
|
|
|
# config.include HelperMethodForHelperSpec, :type => :helper
|
2011-11-21 23:29:45 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
require 'nokogiri'
|
|
|
|
def last_document
|
|
|
|
Nokogiri::HTML(last_response.body)
|
|
|
|
end
|