Sha256: c10bc5450fbd8e118d1e9753bcc92b05d3f7155dd1a9590d7a924ae2b4b92f6c

Contents?: true

Size: 706 Bytes

Versions: 3

Compression:

Stored size: 706 Bytes

Contents

module RSpec::ListingsHelpers
  class FakeRoutes
    def listing_full_path(*options)
      "/"
    end

    def listing_full_url(*options)
      "/"
    end

    def listing_content_url(*options)
      "/"
    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
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
listings-0.1.5 lib/listings/rspec/listings_helpers.rb
listings-0.1.4 lib/rspec/listings_helpers.rb
listings-0.1.0 lib/rspec/listings_helpers.rb