summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-07-02 15:06:59 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-06 16:34:20 +0900
commit2b9446710f6e50904d6cbbfc739b3987a50fba7e (patch)
tree1d2f2f473a5ce46f151965f4c3c1b5cd647fc93b
parent7e2eb6ee88fd733042b6607e280a99ad189ad7cb (diff)
downloadgitlab-ce-2b9446710f6e50904d6cbbfc739b3987a50fba7e.tar.gz
Fix spec
-rw-r--r--app/controllers/groups/variables_controller.rb9
-rw-r--r--db/migrate/20170525130346_create_group_variables_table.rb2
-rw-r--r--spec/presenters/ci/group_variable_presenter_spec.rb6
-rw-r--r--spec/presenters/ci/variable_presenter_spec.rb8
4 files changed, 14 insertions, 11 deletions
diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb
index 0b65af82afb..1f4a298d54d 100644
--- a/app/controllers/groups/variables_controller.rb
+++ b/app/controllers/groups/variables_controller.rb
@@ -12,7 +12,8 @@ module Groups
def update
if variable.update(group_params)
- redirect_to group_variables_path(group), notice: 'Variable was successfully updated.'
+ redirect_to group_variables_path(group),
+ notice: 'Variable was successfully updated.'
else
render "show"
end
@@ -22,7 +23,8 @@ module Groups
new_variable = Ci::GroupVariable.new(group_params)
if new_variable.valid? && group.variables << new_variable
- redirect_to group_settings_ci_cd_path(group), notice: 'Variables were successfully updated.'
+ redirect_to group_settings_ci_cd_path(group),
+ notice: 'Variables were successfully updated.'
else
@variable = new_variable.present(current_user: current_user)
render "show"
@@ -32,7 +34,8 @@ module Groups
def destroy
variable.destroy
- redirect_to group_settings_ci_cd_path(group), notice: 'Variable was successfully removed.'
+ redirect_to group_settings_ci_cd_path(group), status: 302,
+ notice: 'Variable was successfully removed.'
end
private
diff --git a/db/migrate/20170525130346_create_group_variables_table.rb b/db/migrate/20170525130346_create_group_variables_table.rb
index 2da1c782a1b..eaa38dbc40d 100644
--- a/db/migrate/20170525130346_create_group_variables_table.rb
+++ b/db/migrate/20170525130346_create_group_variables_table.rb
@@ -11,7 +11,7 @@ class CreateGroupVariablesTable < ActiveRecord::Migration
t.integer :group_id, null: false
t.boolean :protected, default: false, null: false
- t.timestamps null: false
+ t.timestamps_with_timezone null: false
end
add_index :ci_group_variables, [:group_id, :key], unique: true
diff --git a/spec/presenters/ci/group_variable_presenter_spec.rb b/spec/presenters/ci/group_variable_presenter_spec.rb
index 510361ae0f8..1b5dade3ca0 100644
--- a/spec/presenters/ci/group_variable_presenter_spec.rb
+++ b/spec/presenters/ci/group_variable_presenter_spec.rb
@@ -32,10 +32,10 @@ describe Ci::GroupVariablePresenter do
it { is_expected.to eq('GROUP_VARIABLE') }
end
- describe '#create_update_path' do
+ describe '#form_path' do
context 'when variable is persisted' do
let(:path) { "/groups/#{group.name}/variables/#{variable.id}" }
- subject { described_class.new(variable).create_update_path }
+ subject { described_class.new(variable).form_path }
it { is_expected.to eq(path) }
end
@@ -43,7 +43,7 @@ describe Ci::GroupVariablePresenter do
context 'when variable is not persisted' do
let(:path) { "/groups/#{group.name}/variables" }
let(:variable) { build(:ci_group_variable, group: group) }
- subject { described_class.new(variable).create_update_path }
+ subject { described_class.new(variable).form_path }
it { is_expected.to eq(path) }
end
diff --git a/spec/presenters/ci/variable_presenter_spec.rb b/spec/presenters/ci/variable_presenter_spec.rb
index d040af43c66..ff4ad215d04 100644
--- a/spec/presenters/ci/variable_presenter_spec.rb
+++ b/spec/presenters/ci/variable_presenter_spec.rb
@@ -32,18 +32,18 @@ describe Ci::VariablePresenter do
it { is_expected.to eq('PROJECT_VARIABLE') }
end
- describe '#create_update_path' do
+ describe '#form_path' do
context 'when variable is persisted' do
let(:path) { "/#{project.namespace.name}/#{project.name}/variables/#{variable.id}" }
- subject { described_class.new(variable).create_update_path }
+ subject { described_class.new(variable).form_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(path) }
end
context 'when variable is not persisted' do
let(:variable) { build(:ci_variable, project: project) }
let(:path) { "/#{project.namespace.name}/#{project.name}/variables" }
- subject { described_class.new(variable).create_update_path }
+ subject { described_class.new(variable).form_path }
it { is_expected.to eq(path) }
end