Sha256: 07618bbe8e74715dbfa72f35b20ea0afe9a33555fd84b8150f076ae820e5a59c

Contents?: true

Size: 1.17 KB

Versions: 67

Compression:

Stored size: 1.17 KB

Contents

require 'test/spec'
require 'stringio'
require 'uri'

begin
  require 'rack/mock'

  $-w, w = nil, $-w               # yuck
  require 'camping'
  require 'rack/adapter/camping'

  Camping.goes :CampApp
  module CampApp
    module Controllers
      class HW < R('/')
        def get
          @headers["X-Served-By"] = URI("http://rack.rubyforge.org")
          "Camping works!"
        end

        def post
          "Data: #{input.foo}"
        end
      end
    end
  end
  $-w = w

  context "Rack::Adapter::Camping" do
    specify "works with GET" do
      res = Rack::MockRequest.new(Rack::Adapter::Camping.new(CampApp)).
        get("/")

      res.should.be.ok
      res["Content-Type"].should.equal "text/html"
      res["X-Served-By"].should.equal "http://rack.rubyforge.org"

      res.body.should.equal "Camping works!"
    end

    specify "works with POST" do
      res = Rack::MockRequest.new(Rack::Adapter::Camping.new(CampApp)).
        post("/", :input => "foo=bar")

      res.should.be.ok
      res.body.should.equal "Data: bar"
    end
  end
rescue LoadError
  $stderr.puts "Skipping Rack::Adapter::Camping tests (Camping is required). `gem install camping` and try again."
end

Version data entries

67 entries across 66 versions & 18 rubygems

Version Path
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_camping.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_camping.rb
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_camping.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_camping.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/rack-1.1.0/test/spec_rack_camping.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_camping.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_camping.rb
rack-1.1.0 test/spec_rack_camping.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
rango-0.0.6 vendor/rack/test/spec_rack_camping.rb
rango-0.1.pre vendor/rack/test/spec_rack_camping.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_camping.rb
middleman-0.10.17 vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
middleman-0.10.16 vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
middleman-0.10.15 vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb
rackjour-0.1.8 vendor/gems/gems/rack-1.0.1/test/spec_rack_camping.rb