From 7d6c098047226aaf10a23a390b412d99211b1020 Mon Sep 17 00:00:00 2001 From: Adam Townsend Date: Wed, 11 Oct 2023 19:18:47 -0700 Subject: [PATCH] added more to the spec test for creating a new link --- spec/create_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/create_spec.rb b/spec/create_spec.rb index 558820e..19b6880 100644 --- a/spec/create_spec.rb +++ b/spec/create_spec.rb @@ -14,8 +14,13 @@ end describe "Submit API request to create new link" do include Rack::Test::Methods it "should return link data in json format" do - post '/create' - last_response.should be_ok + data = { + url: 'http://google.com' + } + res = post('/create', data.to_json, "CONTENT_TYPE" => "application/json") + expect(last_response).to be_ok + expect(JSON.parse(last_response.body)['url']).to eq(data[:url]) + expect(JSON.parse(last_response.body)['code']).not_to eq(nil) end end