From c0f57cc213b6b54d32a15a31ef9bd35cb85dae5e Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 13 Apr 2016 11:53:21 +0200 Subject: [PATCH] [ongoing] availability tests --- test/integration/availabilities_test.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/integration/availabilities_test.rb b/test/integration/availabilities_test.rb index 94db8f5da..8b399ea60 100644 --- a/test/integration/availabilities_test.rb +++ b/test/integration/availabilities_test.rb @@ -4,10 +4,23 @@ class AvailabilitiesTest < ActionDispatch::IntegrationTest login_as(admin, scope: :user) end - test "return availability by id" do + test 'return availability by id' do a = Availability.take get "/api/availabilities/#{a.id}" + + # Check response format & status assert_equal 200, response.status + assert_equal Mime::JSON, response.content_type + + # Check the correct availability was returned + availability = json_response(response.body) + assert_equal a.id, availability[:id], 'availability id does not match' + end + + test 'get machine availabilities' do + m = Machine.find_by_slug('decoupeuse-vinyle') + + get "/api/availabilities/machines/#{m.id}" end end