summaryrefslogtreecommitdiff
path: root/spec/functional/tiny_server_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functional/tiny_server_spec.rb')
-rw-r--r--spec/functional/tiny_server_spec.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/functional/tiny_server_spec.rb b/spec/functional/tiny_server_spec.rb
index d21248062a..ebbf9a92dd 100644
--- a/spec/functional/tiny_server_spec.rb
+++ b/spec/functional/tiny_server_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
+require "spec_helper"
+require "tiny_server"
describe TinyServer::API do
before do
@@ -30,30 +30,30 @@ describe TinyServer::API do
end
it "clears the router" do
- @api.get('/blargh', 200, "blargh")
+ @api.get("/blargh", 200, "blargh")
@api.clear
expect(@api.routes["GET"]).to be_empty
end
it "creates a route for a GET request" do
- @api.get('/foo/bar', 200, 'hello foobar')
+ @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')
- expect(response).to eq([200, {'Content-Type' => 'application/json'}, [ 'hello foobar' ]])
+ response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "http://localhost:1974/foo/bar")
+ 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')
- expect(response).to eq([200, {'Content-Type' => 'application/json'}, [ 'hello barbaz' ]])
+ @api.get("/bar/baz", 200) { block_called = true; "hello barbaz" }
+ response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "http://localhost:1974/bar/baz")
+ 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 = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "/no_such_thing")
expect(response[0]).to eq(404)
- expect(response[1]).to eq({'Content-Type' => 'application/json'})
+ 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)
expect(response_obj["message"]).to eq("no data matches the request for /no_such_thing")
@@ -70,7 +70,7 @@ describe TinyServer::Manager do
TinyServer::API.instance.get("/index", 200, "[\"hello\"]")
- rest = Chef::HTTP.new('http://localhost:9000')
+ rest = Chef::HTTP.new("http://localhost:9000")
expect(rest.get("index")).to eq("[\"hello\"]")
@server.stop