1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

[ongoing] availability tests

This commit is contained in:
Sylvain 2016-04-13 11:53:21 +02:00
parent 02c72e55d9
commit c0f57cc213

View File

@ -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