blob: 96f49bb36f56c5fbf94e84f7b06eb18b5fdae08a (
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
|
RSpec.describe LinesController, :type => :controller do
login_user
let(:line_referential) { create :line_referential, member: @user.organisation }
let(:line) { create :line, line_referential: line_referential }
describe 'PUT deactivate' do
let(:request){ put :deactivate, id: line.id, line_referential_id: line_referential.id }
it 'should respond with 403' do
expect(request).to have_http_status 403
end
with_permission "lines.change_status" do
it 'returns HTTP success' do
expect(request).to redirect_to [line_referential, line]
expect(line.reload).to be_deactivated
end
end
end
describe 'PUT activate' do
let(:request){ put :activate, id: line.id, line_referential_id: line_referential.id }
before(:each){
line.deactivate!
}
it 'should respond with 403' do
expect(request).to have_http_status 403
end
with_permission "lines.change_status" do
it 'returns HTTP success' do
expect(request).to redirect_to [line_referential, line]
expect(line.reload).to be_activated
end
end
end
end
|