Commit cbaf2384 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'jej-backport-active-tense-specs' into 'master'

Port 'Active tense test coverage' changes from EE

See merge request !8921
parents 1d013ee9 ceb1ebd9
...@@ -89,7 +89,7 @@ describe 'Comments', feature: true do ...@@ -89,7 +89,7 @@ describe 'Comments', feature: true do
end end
end end
it 'should reset the edit note form textarea with the original content of the note if cancelled' do it 'resets the edit note form textarea with the original content of the note if cancelled' do
within('.current-note-edit-form') do within('.current-note-edit-form') do
fill_in 'note[note]', with: 'Some new content' fill_in 'note[note]', with: 'Some new content'
find('.btn-cancel').click find('.btn-cancel').click
...@@ -198,7 +198,7 @@ describe 'Comments', feature: true do ...@@ -198,7 +198,7 @@ describe 'Comments', feature: true do
end end
describe 'the note form' do describe 'the note form' do
it "shouldn't add a second form for same row" do it "does not add a second form for same row" do
click_diff_line click_diff_line
is_expected. is_expected.
...@@ -206,7 +206,7 @@ describe 'Comments', feature: true do ...@@ -206,7 +206,7 @@ describe 'Comments', feature: true do
count: 1) count: 1)
end end
it 'should be removed when canceled' do it 'is removed when canceled' do
is_expected.to have_css('.js-temp-notes-holder') is_expected.to have_css('.js-temp-notes-holder')
page.within("form[data-line-code='#{line_code}']") do page.within("form[data-line-code='#{line_code}']") do
......
...@@ -134,7 +134,7 @@ describe DiffHelper do ...@@ -134,7 +134,7 @@ describe DiffHelper do
let(:new_pos) { 50 } let(:new_pos) { 50 }
let(:text) { 'some_text' } let(:text) { 'some_text' }
it "should generate foldable top match line for inline view with empty text by default" do it "generates foldable top match line for inline view with empty text by default" do
output = diff_match_line old_pos, new_pos output = diff_match_line old_pos, new_pos
expect(output).to be_html_safe expect(output).to be_html_safe
...@@ -143,7 +143,7 @@ describe DiffHelper do ...@@ -143,7 +143,7 @@ describe DiffHelper do
expect(output).to have_css 'td:nth-child(3):not(.parallel).line_content.match', text: '' expect(output).to have_css 'td:nth-child(3):not(.parallel).line_content.match', text: ''
end end
it "should allow to define text and bottom option" do it "allows to define text and bottom option" do
output = diff_match_line old_pos, new_pos, text: text, bottom: true output = diff_match_line old_pos, new_pos, text: text, bottom: true
expect(output).to be_html_safe expect(output).to be_html_safe
...@@ -152,7 +152,7 @@ describe DiffHelper do ...@@ -152,7 +152,7 @@ describe DiffHelper do
expect(output).to have_css 'td:nth-child(3):not(.parallel).line_content.match', text: text expect(output).to have_css 'td:nth-child(3):not(.parallel).line_content.match', text: text
end end
it "should generate match line for parallel view" do it "generates match line for parallel view" do
output = diff_match_line old_pos, new_pos, text: text, view: :parallel output = diff_match_line old_pos, new_pos, text: text, view: :parallel
expect(output).to be_html_safe expect(output).to be_html_safe
...@@ -162,7 +162,7 @@ describe DiffHelper do ...@@ -162,7 +162,7 @@ describe DiffHelper do
expect(output).to have_css 'td:nth-child(4).line_content.match.parallel', text: text expect(output).to have_css 'td:nth-child(4).line_content.match.parallel', text: text
end end
it "should allow to generate only left match line for parallel view" do it "allows to generate only left match line for parallel view" do
output = diff_match_line old_pos, nil, text: text, view: :parallel output = diff_match_line old_pos, nil, text: text, view: :parallel
expect(output).to be_html_safe expect(output).to be_html_safe
...@@ -171,7 +171,7 @@ describe DiffHelper do ...@@ -171,7 +171,7 @@ describe DiffHelper do
expect(output).not_to have_css 'td:nth-child(3)' expect(output).not_to have_css 'td:nth-child(3)'
end end
it "should allow to generate only right match line for parallel view" do it "allows to generate only right match line for parallel view" do
output = diff_match_line nil, new_pos, text: text, view: :parallel output = diff_match_line nil, new_pos, text: text, view: :parallel
expect(output).to be_html_safe expect(output).to be_html_safe
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
}); });
}); });
describe('::getAwardUrl', function() { describe('::getAwardUrl', function() {
return it('should return the url for request', function() { return it('returns the url for request', function() {
return expect(awardsHandler.getAwardUrl()).toBe('http://test.host/frontend-fixtures/issues-project/issues/1/toggle_award_emoji'); return expect(awardsHandler.getAwardUrl()).toBe('http://test.host/frontend-fixtures/issues-project/issues/1/toggle_award_emoji');
}); });
}); });
......
...@@ -12,11 +12,11 @@ describe Gitlab::Diff::Highlight, lib: true do ...@@ -12,11 +12,11 @@ describe Gitlab::Diff::Highlight, lib: true do
context "with a diff file" do context "with a diff file" do
let(:subject) { Gitlab::Diff::Highlight.new(diff_file, repository: project.repository).highlight } let(:subject) { Gitlab::Diff::Highlight.new(diff_file, repository: project.repository).highlight }
it 'should return Gitlab::Diff::Line elements' do it 'returns Gitlab::Diff::Line elements' do
expect(subject.first).to be_an_instance_of(Gitlab::Diff::Line) expect(subject.first).to be_an_instance_of(Gitlab::Diff::Line)
end end
it 'should not modify "match" lines' do it 'does not modify "match" lines' do
expect(subject[0].text).to eq('@@ -6,12 +6,18 @@ module Popen') expect(subject[0].text).to eq('@@ -6,12 +6,18 @@ module Popen')
expect(subject[22].text).to eq('@@ -19,6 +25,7 @@ module Popen') expect(subject[22].text).to eq('@@ -19,6 +25,7 @@ module Popen')
end end
...@@ -43,11 +43,11 @@ describe Gitlab::Diff::Highlight, lib: true do ...@@ -43,11 +43,11 @@ describe Gitlab::Diff::Highlight, lib: true do
context "with diff lines" do context "with diff lines" do
let(:subject) { Gitlab::Diff::Highlight.new(diff_file.diff_lines, repository: project.repository).highlight } let(:subject) { Gitlab::Diff::Highlight.new(diff_file.diff_lines, repository: project.repository).highlight }
it 'should return Gitlab::Diff::Line elements' do it 'returns Gitlab::Diff::Line elements' do
expect(subject.first).to be_an_instance_of(Gitlab::Diff::Line) expect(subject.first).to be_an_instance_of(Gitlab::Diff::Line)
end end
it 'should not modify "match" lines' do it 'does not modify "match" lines' do
expect(subject[0].text).to eq('@@ -6,12 +6,18 @@ module Popen') expect(subject[0].text).to eq('@@ -6,12 +6,18 @@ module Popen')
expect(subject[22].text).to eq('@@ -19,6 +25,7 @@ module Popen') expect(subject[22].text).to eq('@@ -19,6 +25,7 @@ module Popen')
end end
......
...@@ -12,7 +12,7 @@ describe Gitlab::Diff::ParallelDiff, lib: true do ...@@ -12,7 +12,7 @@ describe Gitlab::Diff::ParallelDiff, lib: true do
subject { described_class.new(diff_file) } subject { described_class.new(diff_file) }
describe '#parallelize' do describe '#parallelize' do
it 'should return an array of arrays containing the parsed diff' do it 'returns an array of arrays containing the parsed diff' do
diff_lines = diff_file.highlighted_diff_lines diff_lines = diff_file.highlighted_diff_lines
expected = [ expected = [
# Unchanged lines # Unchanged lines
......
...@@ -12,7 +12,7 @@ describe Gitlab::Highlight, lib: true do ...@@ -12,7 +12,7 @@ describe Gitlab::Highlight, lib: true do
Gitlab::Highlight.highlight_lines(project.repository, commit.id, 'files/ruby/popen.rb') Gitlab::Highlight.highlight_lines(project.repository, commit.id, 'files/ruby/popen.rb')
end end
it 'should properly highlight all the lines' do it 'highlights all the lines properly' do
expect(lines[4]).to eq(%Q{<span id="LC5" class="line"> <span class="kp">extend</span> <span class="nb">self</span></span>\n}) expect(lines[4]).to eq(%Q{<span id="LC5" class="line"> <span class="kp">extend</span> <span class="nb">self</span></span>\n})
expect(lines[21]).to eq(%Q{<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>\n}) expect(lines[21]).to eq(%Q{<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>\n})
expect(lines[26]).to eq(%Q{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>\n}) expect(lines[26]).to eq(%Q{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>\n})
......
...@@ -14,7 +14,7 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -14,7 +14,7 @@ describe Gitlab::LDAP::Access, lib: true do
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
it 'should block user in GitLab' do it 'blocks user in GitLab' do
expect(access).to receive(:block_user).with(user, 'does not exist anymore') expect(access).to receive(:block_user).with(user, 'does not exist anymore')
access.allowed? access.allowed?
......
...@@ -67,7 +67,7 @@ describe API::Builds, api: true do ...@@ -67,7 +67,7 @@ describe API::Builds, api: true do
context 'unauthorized user' do context 'unauthorized user' do
let(:api_user) { nil } let(:api_user) { nil }
it 'should not return project builds' do it 'does not return project builds' do
expect(response).to have_http_status(401) expect(response).to have_http_status(401)
end end
end end
......
...@@ -326,7 +326,7 @@ describe API::Groups, api: true do ...@@ -326,7 +326,7 @@ describe API::Groups, api: true do
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
end end
it "should only return projects to which user has access" do it "only returns projects to which user has access" do
project3.team << [user3, :developer] project3.team << [user3, :developer]
get api("/groups/#{group1.id}/projects", user3) get api("/groups/#{group1.id}/projects", user3)
...@@ -338,7 +338,7 @@ describe API::Groups, api: true do ...@@ -338,7 +338,7 @@ describe API::Groups, api: true do
end end
context "when authenticated as admin" do context "when authenticated as admin" do
it "should return any existing group" do it "returns any existing group" do
get api("/groups/#{group2.id}/projects", admin) get api("/groups/#{group2.id}/projects", admin)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -346,7 +346,7 @@ describe API::Groups, api: true do ...@@ -346,7 +346,7 @@ describe API::Groups, api: true do
expect(json_response.first['name']).to eq(project2.name) expect(json_response.first['name']).to eq(project2.name)
end end
it "should not return a non existing group" do it "does not return a non existing group" do
get api("/groups/1328/projects", admin) get api("/groups/1328/projects", admin)
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
...@@ -354,7 +354,7 @@ describe API::Groups, api: true do ...@@ -354,7 +354,7 @@ describe API::Groups, api: true do
end end
context 'when using group path in URL' do context 'when using group path in URL' do
it 'should return any existing group' do it 'returns any existing group' do
get api("/groups/#{group1.path}/projects", admin) get api("/groups/#{group1.path}/projects", admin)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
......
...@@ -459,7 +459,7 @@ describe API::Projects, api: true do ...@@ -459,7 +459,7 @@ describe API::Projects, api: true do
before { project } before { project }
before { admin } before { admin }
it 'should create new project without path and return 201' do it 'creates new project without path and return 201' do
expect { post api("/projects/user/#{user.id}", admin), name: 'foo' }.to change {Project.count}.by(1) expect { post api("/projects/user/#{user.id}", admin), name: 'foo' }.to change {Project.count}.by(1)
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
end end
......
...@@ -458,7 +458,7 @@ describe Ci::API::Builds do ...@@ -458,7 +458,7 @@ describe Ci::API::Builds do
before { build.run! } before { build.run! }
describe "POST /builds/:id/artifacts/authorize" do describe "POST /builds/:id/artifacts/authorize" do
context "should authorize posting artifact to running build" do context "authorizes posting artifact to running build" do
it "using token as parameter" do it "using token as parameter" do
post authorize_url, { token: build.token }, headers post authorize_url, { token: build.token }, headers
...@@ -492,7 +492,7 @@ describe Ci::API::Builds do ...@@ -492,7 +492,7 @@ describe Ci::API::Builds do
end end
end end
context "should fail to post too large artifact" do context "fails to post too large artifact" do
it "using token as parameter" do it "using token as parameter" do
stub_application_setting(max_artifacts_size: 0) stub_application_setting(max_artifacts_size: 0)
......
...@@ -9,7 +9,7 @@ describe EventCreateService, services: true do ...@@ -9,7 +9,7 @@ describe EventCreateService, services: true do
it { expect(service.open_issue(issue, issue.author)).to be_truthy } it { expect(service.open_issue(issue, issue.author)).to be_truthy }
it "should create new event" do it "creates new event" do
expect { service.open_issue(issue, issue.author) }.to change { Event.count } expect { service.open_issue(issue, issue.author) }.to change { Event.count }
end end
end end
...@@ -19,7 +19,7 @@ describe EventCreateService, services: true do ...@@ -19,7 +19,7 @@ describe EventCreateService, services: true do
it { expect(service.close_issue(issue, issue.author)).to be_truthy } it { expect(service.close_issue(issue, issue.author)).to be_truthy }
it "should create new event" do it "creates new event" do
expect { service.close_issue(issue, issue.author) }.to change { Event.count } expect { service.close_issue(issue, issue.author) }.to change { Event.count }
end end
end end
...@@ -29,7 +29,7 @@ describe EventCreateService, services: true do ...@@ -29,7 +29,7 @@ describe EventCreateService, services: true do
it { expect(service.reopen_issue(issue, issue.author)).to be_truthy } it { expect(service.reopen_issue(issue, issue.author)).to be_truthy }
it "should create new event" do it "creates new event" do
expect { service.reopen_issue(issue, issue.author) }.to change { Event.count } expect { service.reopen_issue(issue, issue.author) }.to change { Event.count }
end end
end end
......
...@@ -29,7 +29,7 @@ describe MergeRequests::CloseService, services: true do ...@@ -29,7 +29,7 @@ describe MergeRequests::CloseService, services: true do
it { expect(@merge_request).to be_valid } it { expect(@merge_request).to be_valid }
it { expect(@merge_request).to be_closed } it { expect(@merge_request).to be_closed }
it 'should execute hooks with close action' do it 'executes hooks with close action' do
expect(service).to have_received(:execute_hooks). expect(service).to have_received(:execute_hooks).
with(@merge_request, 'close') with(@merge_request, 'close')
end end
......
...@@ -20,7 +20,7 @@ describe 'gitlab:mail_google_schema_whitelisting rake task' do ...@@ -20,7 +20,7 @@ describe 'gitlab:mail_google_schema_whitelisting rake task' do
Rake.application.invoke_task "gitlab:mail_google_schema_whitelisting" Rake.application.invoke_task "gitlab:mail_google_schema_whitelisting"
end end
it 'should run the task without errors' do it 'runs the task without errors' do
expect { run_rake_task }.not_to raise_error expect { run_rake_task }.not_to raise_error
end end
end end
......
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