summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-10-18 10:54:52 +0000
committerDouwe Maan <douwe@gitlab.com>2017-10-18 10:54:52 +0000
commitcddc504740eea1e017c1ce23b84c6b19044020f4 (patch)
tree2d6db7826d63a5d8f58bb91dc4854b54c3bbbe5d /spec
parent220a5c375972462a3c583a106c5ca4c8a2138267 (diff)
parent3b462b457756f36142d2450eaac7cf9f3e2061ae (diff)
downloadgitlab-ce-cddc504740eea1e017c1ce23b84c6b19044020f4.tar.gz
Merge branch '30140-restore-readme-only-preference' into 'master'
Add readme only option as project view Closes #30140 See merge request gitlab-org/gitlab-ce!14900
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects_controller_spec.rb8
-rw-r--r--spec/migrations/migrate_user_project_view_spec.rb7
2 files changed, 9 insertions, 6 deletions
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 0544afe31ed..7569052c3aa 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -222,6 +222,14 @@ describe ProjectsController do
get :show, namespace_id: public_project.namespace, id: public_project
expect(response).to render_template('_files')
end
+
+ it "renders the readme view" do
+ allow(controller).to receive(:current_user).and_return(user)
+ allow(user).to receive(:project_view).and_return('readme')
+
+ get :show, namespace_id: public_project.namespace, id: public_project
+ expect(response).to render_template('_readme')
+ end
end
context "when the url contains .atom" do
diff --git a/spec/migrations/migrate_user_project_view_spec.rb b/spec/migrations/migrate_user_project_view_spec.rb
index afaa5d836a7..5e16769d63a 100644
--- a/spec/migrations/migrate_user_project_view_spec.rb
+++ b/spec/migrations/migrate_user_project_view_spec.rb
@@ -5,12 +5,7 @@ require Rails.root.join('db', 'post_migrate', '20170406142253_migrate_user_proje
describe MigrateUserProjectView, :truncate do
let(:migration) { described_class.new }
- let!(:user) { create(:user) }
-
- before do
- # 0 is the numeric value for the old 'readme' option
- user.update_column(:project_view, 0)
- end
+ let!(:user) { create(:user, project_view: 'readme') }
describe '#up' do
it 'updates project view setting with new value' do