blob: 4050a8812196f7505ff416398d79d8db67f3e44b (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
describe ReferentialsController, :type => :controller do
login_user
let(:referential) { Referential.first }
let(:organisation) { create :organisation }
let(:other_referential) { create :referential, organisation: organisation }
describe 'PUT archive' do
context "user's organisation matches referential's organisation" do
it 'returns http success' do
put :archive, id: referential.id
expect(response).to have_http_status(302)
end
end
context "user's organisation doesn't match referential's organisation" do
pending "hotfix opens all unknow actions need to close the uneeded later" do
#it 'raises a ActiveRecord::RecordNotFound' do
expect { put :archive, id: other_referential.id }.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
describe 'GET select_compliance_control_set' do
it 'gets compliance control set for current organisation' do
compliance_control_set = create(:compliance_control_set, organisation: @user.organisation)
create(:compliance_control_set)
get :select_compliance_control_set, referential_id: referential.id
expect(assigns[:compliance_control_sets]).to eq([compliance_control_set])
end
end
describe "POST #validate" do
it "displays a flash message" do
post :validate, id: referential.id, params: {
compliance_control_set: create(:compliance_control_set).id
}
expect(controller).to set_flash[:notice].to(
I18n.t('notice.referentials.validate')
)
end
end
describe "POST #create" do
context "when duplicating" do
it "displays a flash message" do
post :create,
from: referential.id,
current_workbench_id: referential.workbench_id,
referential: {
name: 'Duplicated'
}
expect(controller).to set_flash[:notice].to(
I18n.t('notice.referentials.duplicate')
)
end
end
end
end
|