site_config_controller_spec.rb
1.08 KB
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
describe SiteConfigController, type: 'controller' do
it_requires_admin_privileges for: {
index: :get,
update: :put
}
let(:admin) { Fabricate(:admin) }
before { sign_in admin }
describe '#index' do
it 'has an index action' do
get :index
end
end
describe '#update' do
it 'updates' do
put :update, site_config: {
notice_fingerprinter_attributes: {
backtrace_lines: 3,
environment_name: false
}
}
fingerprinter = SiteConfig.document.notice_fingerprinter
expect(fingerprinter.environment_name).to be false
expect(fingerprinter.backtrace_lines).to be 3
end
it 'redirects to the index' do
put :update, site_config: {
notice_fingerprinter_attributes: { error_class: true }
}
expect(response).to redirect_to(site_config_index_path)
end
it 'flashes a confirmation' do
put :update, site_config: {
notice_fingerprinter_attributes: { error_class: true }
}
expect(request.flash[:success]).to eq 'Updated site config'
end
end
end