Sha256: de0a8c010b89a20b0f13f85eb39177661b8d947c7b45e57d6043c51053e9476a
Contents?: true
Size: 921 Bytes
Versions: 5
Compression:
Stored size: 921 Bytes
Contents
require File.expand_path("../../spec_helper", __FILE__) describe CukeQ::WebApp do include Rack::Test::Methods def app @app ||= CukeQ::WebApp.new(URI.parse("http://localhost:9292")) end it "errors if the request is not a POST" do get "/" last_response.should_not be_ok last_response.headers['Allow'].should == 'POST' end it "errors if the POST body is not valid JSON" do post "/", 'not json' last_response.should_not be_ok last_response.headers['Content-Type'].should == 'application/json' end it "accepts valid JSON" do post "/", '{"some":"data"}' last_response.status.should == 202 last_response.body.should == "ok" end it "starts the app with the given callback" do app.handler.should_receive(:run).with(app, {:Host => 'localhost', :Port => 9292}) app.run("callback") app.instance_variable_get("@callback").should == "callback" end end
Version data entries
5 entries across 5 versions & 1 rubygems