Commit 85296e80 authored by Sean Arnold's avatar Sean Arnold

Update specs and controller method name

parent b30593ff
...@@ -41,7 +41,7 @@ module EE ...@@ -41,7 +41,7 @@ module EE
project.feature_available?(:tracing, current_user) project.feature_available?(:tracing, current_user)
end end
def has_status_page_licence? def has_status_page_license?
project.feature_available?(:status_page, current_user) project.feature_available?(:status_page, current_user)
end end
...@@ -62,7 +62,7 @@ module EE ...@@ -62,7 +62,7 @@ module EE
permitted_params[:tracing_setting_attributes] = [:external_url] permitted_params[:tracing_setting_attributes] = [:external_url]
end end
if has_status_page_licence? if has_status_page_license?
permitted_params.merge!(status_page_setting_params) permitted_params.merge!(status_page_setting_params)
end end
......
...@@ -11,7 +11,7 @@ describe OperationsHelper do ...@@ -11,7 +11,7 @@ describe OperationsHelper do
before do before do
helper.instance_variable_set(:@project, project) helper.instance_variable_set(:@project, project)
allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:current_user) { user }
allow(helper) allow(helper)
.to receive(:can?).with(user, :admin_operations, project) { true } .to receive(:can?).with(user, :admin_operations, project) { true }
end end
...@@ -31,8 +31,15 @@ describe OperationsHelper do ...@@ -31,8 +31,15 @@ describe OperationsHelper do
) )
end end
it 'returns nil or true for the values' do it 'returns the correct values' do
expect(subject.values.uniq).to contain_exactly('true', nil) expect(subject).to eq(
'user-can-enable-status-page' => 'true',
'setting-enabled' => nil,
'setting-aws-access-key' => nil,
'setting-masked-aws-secret-key' => nil,
'setting-aws-region' => nil,
'setting-aws-s3-bucket-name' => nil
)
end end
context 'user does not have permission' do context 'user does not have permission' do
...@@ -41,8 +48,15 @@ describe OperationsHelper do ...@@ -41,8 +48,15 @@ describe OperationsHelper do
.to receive(:can?).with(user, :admin_operations, project) { false } .to receive(:can?).with(user, :admin_operations, project) { false }
end end
it 'returns nil or true for the values' do it 'returns the correct values' do
expect(subject.values.uniq).to contain_exactly('false', nil) expect(subject).to eq(
'user-can-enable-status-page' => 'false',
'setting-enabled' => nil,
'setting-aws-access-key' => nil,
'setting-masked-aws-secret-key' => nil,
'setting-aws-region' => nil,
'setting-aws-s3-bucket-name' => nil
)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment