diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index a0909cec3bd6f77f916aa1e86b9284441e1b8ecc..1ea1227b28b3b1c404b7674c84b01b50f9667262 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -15,9 +15,9 @@ describe AutocompleteController do let(:body) { JSON.parse(response.body) } - it { body.should be_kind_of(Array) } - it { body.size.should eq(1) } - it { body.first["username"].should == user.username } + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq(1) } + it { expect(body.first["username"]).to eq user.username } end context 'group members' do @@ -32,9 +32,9 @@ describe AutocompleteController do let(:body) { JSON.parse(response.body) } - it { body.should be_kind_of(Array) } - it { body.size.should eq(1) } - it { body.first["username"].should == user.username } + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq(1) } + it { expect(body.first["username"]).to eq user.username } end context 'all users' do @@ -45,7 +45,7 @@ describe AutocompleteController do let(:body) { JSON.parse(response.body) } - it { body.should be_kind_of(Array) } - it { body.size.should eq(User.count) } + it { expect(body).to be_kind_of(Array) } + it { expect(body.size).to eq(User.count) } end end diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index c47368b1fdaa13ff39c3e1740a443be7a12a11ec..b69b59d4158040a67cfde8c23e0302fba82a1189 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -90,7 +90,7 @@ describe 'Comments' do #within(".current-note-edit-form") do #fill_in "note[note]", with: "Some new content" #find(".btn-cancel").click - #find(".js-note-text", visible: false).text.should == note.note + #expect(find(".js-note-text", visible: false).text).to eq note.note #end #end diff --git a/spec/lib/gitlab/ldap/access_spec.rb b/spec/lib/gitlab/ldap/access_spec.rb index fc346ea29d0855c939d78cac458e0e0af2bf79dd..038ac7e0d75c9837f24c9898f707e34db8f5dee2 100644 --- a/spec/lib/gitlab/ldap/access_spec.rb +++ b/spec/lib/gitlab/ldap/access_spec.rb @@ -23,7 +23,7 @@ describe Gitlab::LDAP::Access do it "should block user in GitLab" do access.allowed? - user.should be_blocked + expect(user).to be_blocked end end @@ -44,7 +44,7 @@ describe Gitlab::LDAP::Access do it "does not unblock user in GitLab" do access.allowed? - user.should be_blocked + expect(user).to be_blocked end end diff --git a/spec/lib/gitlab/o_auth/auth_hash_spec.rb b/spec/lib/gitlab/o_auth/auth_hash_spec.rb index 678086ffa14353d602ee1764007cdd45e49251d0..165cde4f1608d1d59e99561fb13310d9b7ce4f3f 100644 --- a/spec/lib/gitlab/o_auth/auth_hash_spec.rb +++ b/spec/lib/gitlab/o_auth/auth_hash_spec.rb @@ -80,31 +80,31 @@ describe Gitlab::OAuth::AuthHash do context 'auth_hash constructed with ASCII-8BIT encoding' do it 'forces utf8 encoding on uid' do - auth_hash.uid.encoding.should eql Encoding::UTF_8 + expect(auth_hash.uid.encoding).to eql Encoding::UTF_8 end it 'forces utf8 encoding on provider' do - auth_hash.provider.encoding.should eql Encoding::UTF_8 + expect(auth_hash.provider.encoding).to eql Encoding::UTF_8 end it 'forces utf8 encoding on name' do - auth_hash.name.encoding.should eql Encoding::UTF_8 + expect(auth_hash.name.encoding).to eql Encoding::UTF_8 end it 'forces utf8 encoding on full_name' do - auth_hash.full_name.encoding.should eql Encoding::UTF_8 + expect(auth_hash.full_name.encoding).to eql Encoding::UTF_8 end it 'forces utf8 encoding on username' do - auth_hash.username.encoding.should eql Encoding::UTF_8 + expect(auth_hash.username.encoding).to eql Encoding::UTF_8 end it 'forces utf8 encoding on email' do - auth_hash.email.encoding.should eql Encoding::UTF_8 + expect(auth_hash.email.encoding).to eql Encoding::UTF_8 end it 'forces utf8 encoding on password' do - auth_hash.password.encoding.should eql Encoding::UTF_8 + expect(auth_hash.password.encoding).to eql Encoding::UTF_8 end end end diff --git a/spec/models/external_wiki_service_spec.rb b/spec/models/external_wiki_service_spec.rb index f2e77fc88c43dd9160a22cf51ddcc64a0cac594b..4bd5b0be61cc231decb94aada0961278b7e3b0a0 100644 --- a/spec/models/external_wiki_service_spec.rb +++ b/spec/models/external_wiki_service_spec.rb @@ -52,7 +52,7 @@ describe ExternalWikiService do it 'should replace the wiki url' do wiki_path = get_project_wiki_path(project) - wiki_path.should match('https://gitlab.com') + expect(wiki_path).to match('https://gitlab.com') end end end diff --git a/spec/models/project_services/irker_service_spec.rb b/spec/models/project_services/irker_service_spec.rb index 96ab95c05c900fe6bbfa2727ef2c500a45260efd..4c437aab12b98ae68e14993b6eaf40edf0c0b891 100644 --- a/spec/models/project_services/irker_service_spec.rb +++ b/spec/models/project_services/irker_service_spec.rb @@ -51,7 +51,7 @@ describe IrkerService do let(:_recipients) { 'a b c' } it 'should not add an error if there is 3 recipients' do subject.send :check_recipients_count - subject.errors.should be_blank + expect(subject.errors).to be_blank end end end @@ -96,11 +96,11 @@ describe IrkerService do conn = @irker_server.accept conn.readlines.each do |line| msg = JSON.load(line.chomp("\n")) - msg.keys.should match_array(['to', 'privmsg']) + expect(msg.keys).to match_array(['to', 'privmsg']) if msg['to'].is_a?(String) - msg['to'].should == 'irc://chat.freenode.net/#commits' + expect(msg['to']).to eq 'irc://chat.freenode.net/#commits' else - msg['to'].should match_array(['irc://chat.freenode.net/#commits']) + expect(msg['to']).to match_array(['irc://chat.freenode.net/#commits']) end end conn.close diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 8770786f49a9065e37693662c24a1917b7d1c148..5e65ad18c0e0139ef64b1f5dd5bd81091573232b 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -196,10 +196,10 @@ describe API::API, api: true do it 'should return a project issue by iid' do get api("/projects/#{project.id}/issues?iid=#{issue.iid}", user) - response.status.should == 200 - json_response.first['title'].should == issue.title - json_response.first['id'].should == issue.id - json_response.first['iid'].should == issue.iid + expect(response.status).to eq 200 + expect(json_response.first['title']).to eq issue.title + expect(json_response.first['id']).to eq issue.id + expect(json_response.first['iid']).to eq issue.iid end it "should return 404 if issue id not found" do diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 0ed5883914b377fe84b8625d9688f72d738e3063..38c67bc9971d1e4a3ca6b22f4f06dcd5658ae74b 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -118,9 +118,9 @@ describe API::API, api: true do it 'should return merge_request by iid' do url = "/projects/#{project.id}/merge_requests?iid=#{merge_request.iid}" get api(url, user) - response.status.should == 200 - json_response.first['title'].should == merge_request.title - json_response.first['id'].should == merge_request.id + expect(response.status).to eq 200 + expect(json_response.first['title']).to eq merge_request.title + expect(json_response.first['id']).to eq merge_request.id end it "should return a 404 error if merge_request_id not found" do diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb index 6890dd1f3a7a7cdf9243318b1e4df9abb02c44af..db0f6e3c0f5f02fa643ca00b24a035c710c1c448 100644 --- a/spec/requests/api/milestones_spec.rb +++ b/spec/requests/api/milestones_spec.rb @@ -32,9 +32,9 @@ describe API::API, api: true do it 'should return a project milestone by iid' do get api("/projects/#{project.id}/milestones?iid=#{milestone.iid}", user) - response.status.should == 200 - json_response.first['title'].should == milestone.title - json_response.first['id'].should == milestone.id + expect(response.status).to eq 200 + expect(json_response.first['title']).to eq milestone.title + expect(json_response.first['id']).to eq milestone.id end it 'should return 401 error if user not authenticated' do diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index dbfd72e5f198188b7ac32dab4e8e165b68e3799b..8fb1509c8b248f69d96f801a595f9faabbd64622 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -60,9 +60,9 @@ describe API::API, api: true do it 'should include the project labels as the tag_list' do get api('/projects', user) - response.status.should == 200 - json_response.should be_an Array - json_response.first.keys.should include('tag_list') + expect(response.status).to eq 200 + expect(json_response).to be_an Array + expect(json_response.first.keys).to include('tag_list') end context 'and using search' do diff --git a/spec/services/destroy_group_service_spec.rb b/spec/services/destroy_group_service_spec.rb index 2a7372b986e6bc6d5c64d722e5634f0477215c67..e28564b386679cb98fb581a9917e3e1f66bf546c 100644 --- a/spec/services/destroy_group_service_spec.rb +++ b/spec/services/destroy_group_service_spec.rb @@ -23,8 +23,8 @@ describe DestroyGroupService do Sidekiq::Testing.inline! { destroy_group(group, user) } end - it { gitlab_shell.exists?(group.path).should be_falsey } - it { gitlab_shell.exists?(remove_path).should be_falsey } + it { expect(gitlab_shell.exists?(group.path)).to be_falsey } + it { expect(gitlab_shell.exists?(remove_path)).to be_falsey } end context 'Sidekiq fake' do @@ -33,8 +33,8 @@ describe DestroyGroupService do Sidekiq::Testing.fake! { destroy_group(group, user) } end - it { gitlab_shell.exists?(group.path).should be_falsey } - it { gitlab_shell.exists?(remove_path).should be_truthy } + it { expect(gitlab_shell.exists?(group.path)).to be_falsey } + it { expect(gitlab_shell.exists?(remove_path)).to be_truthy } end end diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb index 381008def5f86aec0283be2dfacfcbc8fc873c5f..e83eef0b1a28275a1e9f4f9f2eb9de63aaba74b2 100644 --- a/spec/services/projects/destroy_service_spec.rb +++ b/spec/services/projects/destroy_service_spec.rb @@ -13,8 +13,8 @@ describe Projects::DestroyService do end it { expect(Project.all).not_to include(project) } - it { Dir.exists?(path).should be_falsey } - it { Dir.exists?(remove_path).should be_falsey } + it { expect(Dir.exists?(path)).to be_falsey } + it { expect(Dir.exists?(remove_path)).to be_falsey } end context 'Sidekiq fake' do @@ -24,8 +24,8 @@ describe Projects::DestroyService do end it { expect(Project.all).not_to include(project) } - it { Dir.exists?(path).should be_falsey } - it { Dir.exists?(remove_path).should be_truthy } + it { expect(Dir.exists?(path)).to be_falsey } + it { expect(Dir.exists?(remove_path)).to be_truthy } end def destroy_project(project, user, params) diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 5650626fb18428cc082776a9bbb6169da491ebfb..79acba78bda3e21d8a8f47db6859fdbc796a276b 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -20,8 +20,7 @@ describe Projects::TransferService do @result = transfer_project(project, user, new_namespace_id: nil) end - it { expect(@result).not_to be_nil } # { result.should be_false } passes on nil - it { expect(@result).to be_falsey } + it { expect(@result).to eq false } it { expect(project.namespace).to eq(user.namespace) } end @@ -30,8 +29,7 @@ describe Projects::TransferService do @result = transfer_project(project, user, new_namespace_id: group.id) end - it { expect(@result).not_to be_nil } # { result.should be_false } passes on nil - it { expect(@result).to be_falsey } + it { expect(@result).to eq false } it { expect(project.namespace).to eq(user.namespace) } end