summaryrefslogtreecommitdiff
path: root/spec/tasks
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-23 10:44:03 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-23 10:44:03 +0200
commitf40b99d02ee9411e5a7f9a93e3e6cf33c1d7890e (patch)
treea55ff4f3ceaa24fcb008114f62b8ac377db6a129 /spec/tasks
parent9369adb93d119ca349add2b7f80d6a9b4bbd6703 (diff)
parent4aa1fdd347d1df4001d9e1298e6dc09c0c478c2e (diff)
downloadgitlab-ce-f40b99d02ee9411e5a7f9a93e3e6cf33c1d7890e.tar.gz
Merge branch 'master' into rubocop-for-tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Conflicts: spec/features/issues_spec.rb spec/models/forked_project_link_spec.rb spec/models/hooks/service_hook_spec.rb spec/models/hooks/web_hook_spec.rb spec/models/project_services/hipchat_service_spec.rb spec/requests/api/project_members_spec.rb spec/requests/api/projects_spec.rb spec/requests/api/system_hooks_spec.rb spec/services/archive_repository_service_spec.rb spec/support/matchers.rb spec/tasks/gitlab/backup_rake_spec.rb
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/backup_rake_spec.rb40
-rw-r--r--spec/tasks/gitlab/mail_google_schema_whitelisting.rb2
2 files changed, 23 insertions, 19 deletions
diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb
index c85214e50dd..2f90b67aef1 100644
--- a/spec/tasks/gitlab/backup_rake_spec.rb
+++ b/spec/tasks/gitlab/backup_rake_spec.rb
@@ -23,30 +23,33 @@ describe 'gitlab:app namespace rake task' do
context 'gitlab version' do
before do
- Dir.stub glob: []
- allow(Dir).to receive :chdir
- File.stub exists?: true
- Kernel.stub system: true
- FileUtils.stub cp_r: true
- FileUtils.stub mv: true
- Rake::Task["gitlab:shell:setup"].stub invoke: true
+ allow(Dir).to receive(:glob).and_return([])
+ allow(Dir).to receive(:chdir)
+ allow(File).to receive(:exists?).and_return(true)
+ allow(Kernel).to receive(:system).and_return(true)
+ allow(FileUtils).to receive(:cp_r).and_return(true)
+ allow(FileUtils).to receive(:mv).and_return(true)
+ allow(Rake::Task["gitlab:shell:setup"]).
+ to receive(:invoke).and_return(true)
end
let(:gitlab_version) { Gitlab::VERSION }
it 'should fail on mismatch' do
- YAML.stub load_file: { gitlab_version: "not #{gitlab_version}" }
- expect { run_rake_task('gitlab:backup:restore') }.to(
- raise_error SystemExit
- )
+ allow(YAML).to receive(:load_file).
+ and_return({gitlab_version: "not #{gitlab_version}" })
+
+ expect { run_rake_task('gitlab:backup:restore') }.
+ to raise_error(SystemExit)
end
it 'should invoke restoration on mach' do
- YAML.stub load_file: { gitlab_version: gitlab_version }
- expect(Rake::Task["gitlab:backup:db:restore"]).to receive :invoke
- expect(Rake::Task["gitlab:backup:repo:restore"]).to receive :invoke
- expect(Rake::Task["gitlab:shell:setup"]).to receive :invoke
- expect { run_rake_task('gitlab:backup:restore') }.to_not raise_error
+ allow(YAML).to receive(:load_file).
+ and_return({gitlab_version: gitlab_version})
+ expect(Rake::Task["gitlab:backup:db:restore"]).to receive(:invoke)
+ expect(Rake::Task["gitlab:backup:repo:restore"]).to receive(:invoke)
+ expect(Rake::Task["gitlab:shell:setup"]).to receive(:invoke)
+ expect { run_rake_task('gitlab:backup:restore') }.not_to raise_error
end
end
@@ -140,13 +143,14 @@ describe 'gitlab:app namespace rake task' do
end
it 'does not invoke repositories restore' do
- Rake::Task["gitlab:shell:setup"].stub invoke: true
+ allow(Rake::Task["gitlab:shell:setup"]).
+ to receive(:invoke).and_return(true)
allow($stdout).to receive :write
expect(Rake::Task["gitlab:backup:db:restore"]).to receive :invoke
expect(Rake::Task["gitlab:backup:repo:restore"]).not_to receive :invoke
expect(Rake::Task["gitlab:shell:setup"]).to receive :invoke
- expect { run_rake_task('gitlab:backup:restore') }.to_not raise_error
+ expect { run_rake_task('gitlab:backup:restore') }.not_to raise_error
end
end
end # gitlab:app namespace
diff --git a/spec/tasks/gitlab/mail_google_schema_whitelisting.rb b/spec/tasks/gitlab/mail_google_schema_whitelisting.rb
index 22e746870dc..37feb5e6faf 100644
--- a/spec/tasks/gitlab/mail_google_schema_whitelisting.rb
+++ b/spec/tasks/gitlab/mail_google_schema_whitelisting.rb
@@ -21,7 +21,7 @@ describe 'gitlab:mail_google_schema_whitelisting rake task' do
end
it 'should run the task without errors' do
- expect { run_rake_task }.to_not raise_error
+ expect { run_rake_task }.not_to raise_error
end
end
end