diff options
Diffstat (limited to 'spec/functional/tiny_server_spec.rb')
-rw-r--r-- | spec/functional/tiny_server_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/functional/tiny_server_spec.rb b/spec/functional/tiny_server_spec.rb index bfa6ff1ddb..87be948a0d 100644 --- a/spec/functional/tiny_server_spec.rb +++ b/spec/functional/tiny_server_spec.rb @@ -26,39 +26,39 @@ describe TinyServer::API do end it "is a Singleton" do - lambda {TinyServer::API.new}.should raise_error + expect {TinyServer::API.new}.to raise_error end it "clears the router" do @api.get('/blargh', 200, "blargh") @api.clear - @api.routes["GET"].should be_empty + expect(@api.routes["GET"]).to be_empty end it "creates a route for a GET request" do @api.get('/foo/bar', 200, 'hello foobar') # WEBrick gives you the full URI with host, Thin only gave the part after scheme+host+port response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => 'http://localhost:1974/foo/bar') - response.should == [200, {'Content-Type' => 'application/json'}, [ 'hello foobar' ]] + expect(response).to eq([200, {'Content-Type' => 'application/json'}, [ 'hello foobar' ]]) end it "creates a route for a request with a block" do block_called = false @api.get('/bar/baz', 200) { block_called = true; 'hello barbaz' } response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => 'http://localhost:1974/bar/baz') - response.should == [200, {'Content-Type' => 'application/json'}, [ 'hello barbaz' ]] - block_called.should be_true + expect(response).to eq([200, {'Content-Type' => 'application/json'}, [ 'hello barbaz' ]]) + expect(block_called).to be_truthy end it "returns debugging info for 404s" do response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => '/no_such_thing') - response[0].should == 404 - response[1].should == {'Content-Type' => 'application/json'} - response[2].should be_a_kind_of(Array) + expect(response[0]).to eq(404) + expect(response[1]).to eq({'Content-Type' => 'application/json'}) + expect(response[2]).to be_a_kind_of(Array) response_obj = Chef::JSONCompat.from_json(response[2].first) - response_obj["message"].should == "no data matches the request for /no_such_thing" - response_obj["available_routes"].should == {"GET"=>[], "PUT"=>[], "POST"=>[], "DELETE"=>[]} - response_obj["request"].should == {"REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"/no_such_thing"} + expect(response_obj["message"]).to eq("no data matches the request for /no_such_thing") + expect(response_obj["available_routes"]).to eq({"GET"=>[], "PUT"=>[], "POST"=>[], "DELETE"=>[]}) + expect(response_obj["request"]).to eq({"REQUEST_METHOD"=>"GET", "REQUEST_URI"=>"/no_such_thing"}) end end @@ -71,7 +71,7 @@ describe TinyServer::Manager do TinyServer::API.instance.get("/index", 200, "[\"hello\"]") rest = Chef::REST.new('http://localhost:9000', false, false) - rest.get_rest("index").should == ["hello"] + expect(rest.get_rest("index")).to eq(["hello"]) @server.stop end |