File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 8787 end
8888 end
8989
90+ # Test suite for PUT /measures/:measure_id/measurements/:id
91+ describe 'PUT /measures/:measure_id/measurements/:id' do
92+ let ( :valid_attributes ) { { size : 67 } }
93+
94+ before { put "/measures/#{ measure_id } /measurements/#{ id } " , params : valid_attributes , headers : headers }
95+
96+ context 'when measurement exists' do
97+ it 'returns status code 204' do
98+ expect ( response ) . to have_http_status ( 204 )
99+ end
100+
101+ it 'updates the measurement' do
102+ updated_measurement = Measurement . find ( id )
103+ expect ( updated_measurement . name ) . to match ( /67/ )
104+ end
105+ end
106+
107+ context 'when the measurement does not exist' do
108+ let ( :id ) { 0 }
109+
110+ it 'returns status code 404' do
111+ expect ( response ) . to have_http_status ( 404 )
112+ end
113+
114+ it 'returns a not found message' do
115+ expect ( response . body ) . to match ( /Couldn't find measurement/ )
116+ end
117+ end
118+ end
119+
90120end
You can’t perform that action at this time.
0 commit comments