rspec-coverage #22

Merged
bucky merged 13 commits from rspec-coverage into master 2023-10-12 23:49:49 -07:00
Showing only changes of commit bbb710a5e1 - Show all commits
+11 -1
View File
@@ -66,7 +66,7 @@ describe "Submit API request to create new link" do
expect(response_json['message']).to eq('invalid url parameter') expect(response_json['message']).to eq('invalid url parameter')
end end
it "should return with a 400 status and 'url not found' message when an invalid url is submitted" do it "should return with a 400 status and 'url not found' message when a 404 url is submitted" do
data = { data = {
url: 'http://google.com/example' url: 'http://google.com/example'
} }
@@ -75,4 +75,14 @@ describe "Submit API request to create new link" do
response_json = JSON.parse(last_response.body) response_json = JSON.parse(last_response.body)
expect(response_json['message']).to eq('url not found') expect(response_json['message']).to eq('url not found')
end end
it "should return with a 400 status and 'url not found' message when a URL with no DNS is submitted" do
data = {
url: 'http://bad.tld'
}
post('/links', data.to_json, "CONTENT_TYPE" => "application/json")
expect(last_response.status).to eq(400)
response_json = JSON.parse(last_response.body)
expect(response_json['message']).to eq('url does not resolve')
end
end end