blob: 23300a0b8d972cdfa34ef23a1b80136c5a0ff98a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminInfoRequestEventController do
describe :update do
describe 'when handling valid data' do
before do
@info_request_event = FactoryGirl.create(:info_request_event)
put :update, :id => @info_request_event
end
it 'gets the info request event' do
assigns[:info_request_event].should == @info_request_event
end
it 'sets the described and calculated states on the event' do
event = InfoRequestEvent.find(@info_request_event.id)
event.described_state.should == 'waiting_clarification'
event.calculated_state.should == 'waiting_clarification'
end
it 'shows a success notice' do
flash[:notice].should == 'Old response marked as having been a clarification'
end
it 'redirects to the request admin page' do
response.should redirect_to(admin_request_url(@info_request_event.info_request))
end
end
it 'raises an exception if the event is not a response' do
@info_request_event = FactoryGirl.create(:sent_event)
lambda{ put :update, :id => @info_request_event }.should raise_error
end
end
end
|