Commit 61f04311 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Codestyle changes

parent 6b934d7f
= form_for @node, as: :geo_node, url: admin_geo_nodes_path, html: { class: 'form-horizontal' } do |f|
-if @node.errors.any?
= form_for geo_node, as: :geo_node, url: admin_geo_nodes_path, html: { class: 'form-horizontal' } do |f|
-if geo_node.errors.any?
.alert.alert-danger
- @node.errors.full_messages.each do |msg|
- geo_node.errors.full_messages.each do |msg|
%p= msg
.form-group
.col-sm-offset-2.col-sm-10
......@@ -13,7 +13,7 @@
= f.label :url, 'URL', class: 'control-label'
.col-sm-10
= f.text_field :url, class: 'form-control'
= f.fields_for :geo_node_key, @node.geo_node_key do |fg|
= f.fields_for :geo_node_key, geo_node.geo_node_key do |fg|
.form-group
= fg.label :key, 'Public Key', class: 'control-label'
.col-sm-10
......
......@@ -8,7 +8,7 @@
%hr
= render :partial => 'form' if Gitlab::Geo.license_allows?
= render :partial => 'form', locals: {geo_node: @node} if Gitlab::Geo.license_allows?
-if @nodes.any?
.panel.panel-default
......
......@@ -23,7 +23,9 @@ describe Admin::GeoNodesController do
subject { get :index }
context 'with add-on license available' do
before { allow(Gitlab::Geo).to receive(:license_allows?).and_return(true) }
before do
allow(Gitlab::Geo).to receive(:license_allows?).and_return(true)
end
it 'renders creation form' do
expect(subject).to render_template(partial: 'admin/geo_nodes/_form')
......@@ -31,7 +33,9 @@ describe Admin::GeoNodesController do
end
context 'without add-on license available' do
before { allow(Gitlab::Geo).to receive(:license_allows?).and_return(false) }
before do
allow(Gitlab::Geo).to receive(:license_allows?).and_return(false)
end
it 'does not render the creation form' do
expect(subject).not_to render_template(partial: 'admin/geo_nodes/_form')
......@@ -51,10 +55,14 @@ describe Admin::GeoNodesController do
describe '#destroy' do
let!(:geo_node) { create(:geo_node) }
subject { delete(:destroy, id: geo_node) }
subject do
delete(:destroy, id: geo_node)
end
context 'without add-on license' do
before { allow(Gitlab::Geo).to receive(:license_allows?).and_return(false) }
before do
allow(Gitlab::Geo).to receive(:license_allows?).and_return(false)
end
it 'deletes the node' do
expect { subject }.to change { GeoNode.count }.by(-1)
......@@ -62,7 +70,9 @@ describe Admin::GeoNodesController do
end
context 'with add-on license' do
before { allow(Gitlab::Geo).to receive(:license_allows?).and_return(true) }
before do
allow(Gitlab::Geo).to receive(:license_allows?).and_return(true)
end
it 'deletes the node' do
expect { subject }.to change { GeoNode.count }.by(-1)
......@@ -84,7 +94,9 @@ describe Admin::GeoNodesController do
end
context 'with add-on license' do
before { allow(Gitlab::Geo).to receive(:license_allows?).and_return(true) }
before do
allow(Gitlab::Geo).to receive(:license_allows?).and_return(true)
end
it 'creates the node' do
expect { subject }.to change { GeoNode.count }.by(1)
......
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