Sha256: 1051835522ea4377aaaaa928beb023cb118ca74180ff179d8f6e1b876616e6c4
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module RSpec::ListingsHelpers class FakeRoutes # def listing_full_path(*options) # "/" # end # def listing_full_url(*options) # "/" # end # def listing_content_url(*options) # "/" # end # def listing_export_url(*options) # "/" # end def method_missing(m, *args, &block) if m.to_s.end_with?("_url") || m.to_s.end_with?("_path") "/" else super end end end def query_listing(name) context = fake_context context.prepare_listing({:listing => name}, context) end def render_listing(name) fake_context.render_listing(name) end def fake_context controller = ActionController::Base.new controller.request = ActionController::TestRequest.new(:host => "http://test.com") context = controller.view_context context.class.send(:define_method, 'listings') do FakeRoutes.new end context.class.send(:define_method, 'main_app') do FakeRoutes.new # routes of the main_app end context end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
listings-0.1.7 | lib/listings/rspec/listings_helpers.rb |
listings-0.1.6 | lib/listings/rspec/listings_helpers.rb |