diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/merge_requests/conflicts_controller_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/conflict/file_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/diff/position_spec.rb | 20 | ||||
-rw-r--r-- | spec/lib/gitlab/git/conflict/parser_spec.rb (renamed from spec/lib/gitlab/git/conflict_parser_spec.rb) | 26 | ||||
-rw-r--r-- | spec/models/diff_note_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/merge_requests/conflicts/resolve_service_spec.rb | 12 |
6 files changed, 38 insertions, 38 deletions
diff --git a/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb b/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb index 7047f14c758..c6d50c28106 100644 --- a/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb +++ b/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb @@ -17,8 +17,8 @@ describe Projects::MergeRequests::ConflictsController do describe 'GET show' do context 'when the conflicts cannot be resolved in the UI' do before do - allow(Gitlab::Git::ConflictParser).to receive(:parse) - .and_raise(Gitlab::Git::ConflictParser::UnmergeableFile) + allow(Gitlab::Git::Conflict::Parser).to receive(:parse) + .and_raise(Gitlab::Git::Conflict::Parser::UnmergeableFile) get :show, namespace_id: merge_request_with_conflicts.project.namespace.to_param, @@ -109,8 +109,8 @@ describe Projects::MergeRequests::ConflictsController do context 'when the conflicts cannot be resolved in the UI' do before do - allow(Gitlab::Git::ConflictParser).to receive(:parse) - .and_raise(Gitlab::Git::ConflictParser::UnmergeableFile) + allow(Gitlab::Git::Conflict::Parser).to receive(:parse) + .and_raise(Gitlab::Git::Conflict::Parser::UnmergeableFile) conflict_for_path('files/ruby/regex.rb') end diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb index 89dd545829b..bf981d2f6f6 100644 --- a/spec/lib/gitlab/conflict/file_spec.rb +++ b/spec/lib/gitlab/conflict/file_spec.rb @@ -10,7 +10,7 @@ describe Gitlab::Conflict::File do let(:index) { rugged.merge_commits(our_commit, their_commit) } let(:rugged_conflict) { index.conflicts.last } let(:raw_conflict_content) { index.merge_file('files/ruby/regex.rb')[:data] } - let(:raw_conflict_file) { Gitlab::Git::ConflictFile.new(repository, our_commit.oid, rugged_conflict, raw_conflict_content) } + let(:raw_conflict_file) { Gitlab::Git::Conflict::File.new(repository, our_commit.oid, rugged_conflict, raw_conflict_content) } let(:conflict_file) { described_class.new(raw_conflict_file, merge_request: merge_request) } describe '#resolve_lines' do @@ -54,13 +54,13 @@ describe Gitlab::Conflict::File do invalid_hash = section_keys.map { |key| [key, 'invalid'] }.to_h expect { conflict_file.resolve_lines({}) } - .to raise_error(Gitlab::Git::Merge::ResolutionError) + .to raise_error(Gitlab::Git::Conflict::Resolver::ResolutionError) expect { conflict_file.resolve_lines(empty_hash) } - .to raise_error(Gitlab::Git::Merge::ResolutionError) + .to raise_error(Gitlab::Git::Conflict::Resolver::ResolutionError) expect { conflict_file.resolve_lines(invalid_hash) } - .to raise_error(Gitlab::Git::Merge::ResolutionError) + .to raise_error(Gitlab::Git::Conflict::Resolver::ResolutionError) end end diff --git a/spec/lib/gitlab/diff/position_spec.rb b/spec/lib/gitlab/diff/position_spec.rb index 79c47653d55..e0c775bb0e9 100644 --- a/spec/lib/gitlab/diff/position_spec.rb +++ b/spec/lib/gitlab/diff/position_spec.rb @@ -40,7 +40,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, subject.new_line, 0) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, subject.new_line, 0) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -108,7 +108,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, subject.new_line, 15) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, subject.new_line, 15) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -149,7 +149,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, subject.new_line, subject.old_line) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, subject.new_line, subject.old_line) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -189,7 +189,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, 13, subject.old_line) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, 13, subject.old_line) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -233,7 +233,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, subject.new_line, 5) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, subject.new_line, 5) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -274,7 +274,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, subject.new_line, subject.old_line) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, subject.new_line, subject.old_line) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -314,7 +314,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, 4, subject.old_line) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, 4, subject.old_line) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -357,7 +357,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, 0, subject.old_line) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, 0, subject.old_line) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -399,7 +399,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, subject.new_line, 0) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, subject.new_line, 0) expect(subject.line_code(project.repository)).to eq(line_code) end @@ -447,7 +447,7 @@ describe Gitlab::Diff::Position do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(subject.file_path, 0, subject.old_line) + line_code = Gitlab::Git::Conflict::LineCode.generate(subject.file_path, 0, subject.old_line) expect(subject.line_code(project.repository)).to eq(line_code) end diff --git a/spec/lib/gitlab/git/conflict_parser_spec.rb b/spec/lib/gitlab/git/conflict/parser_spec.rb index 42eccb8cd4d..7b035a381f1 100644 --- a/spec/lib/gitlab/git/conflict_parser_spec.rb +++ b/spec/lib/gitlab/git/conflict/parser_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::Git::ConflictParser do +describe Gitlab::Git::Conflict::Parser do describe '.parse' do def parse_text(text) described_class.parse(text, our_path: 'README.md', their_path: 'README.md') @@ -125,12 +125,12 @@ CONFLICT context 'when there is a non-start delimiter first' do it 'raises UnexpectedDelimiter when there is a middle delimiter first' do expect { parse_text('=======') } - .to raise_error(Gitlab::Git::ConflictParser::UnexpectedDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::UnexpectedDelimiter) end it 'raises UnexpectedDelimiter when there is an end delimiter first' do expect { parse_text('>>>>>>> README.md') } - .to raise_error(Gitlab::Git::ConflictParser::UnexpectedDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::UnexpectedDelimiter) end it 'does not raise when there is an end delimiter for a different path first' do @@ -145,12 +145,12 @@ CONFLICT it 'raises UnexpectedDelimiter when it is followed by an end delimiter' do expect { parse_text(start_text + '>>>>>>> README.md' + end_text) } - .to raise_error(Gitlab::Git::ConflictParser::UnexpectedDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::UnexpectedDelimiter) end it 'raises UnexpectedDelimiter when it is followed by another start delimiter' do expect { parse_text(start_text + start_text + end_text) } - .to raise_error(Gitlab::Git::ConflictParser::UnexpectedDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::UnexpectedDelimiter) end it 'does not raise when it is followed by a start delimiter for a different path' do @@ -165,12 +165,12 @@ CONFLICT it 'raises UnexpectedDelimiter when it is followed by another middle delimiter' do expect { parse_text(start_text + '=======' + end_text) } - .to raise_error(Gitlab::Git::ConflictParser::UnexpectedDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::UnexpectedDelimiter) end it 'raises UnexpectedDelimiter when it is followed by a start delimiter' do expect { parse_text(start_text + start_text + end_text) } - .to raise_error(Gitlab::Git::ConflictParser::UnexpectedDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::UnexpectedDelimiter) end it 'does not raise when it is followed by a start delimiter for another path' do @@ -183,25 +183,25 @@ CONFLICT start_text = "<<<<<<< README.md\n=======\n" expect { parse_text(start_text) } - .to raise_error(Gitlab::Git::ConflictParser::MissingEndDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::MissingEndDelimiter) expect { parse_text(start_text + '>>>>>>> some-other-path.md') } - .to raise_error(Gitlab::Git::ConflictParser::MissingEndDelimiter) + .to raise_error(Gitlab::Git::Conflict::Parser::MissingEndDelimiter) end end context 'other file types' do it 'raises UnmergeableFile when lines is blank, indicating a binary file' do expect { parse_text('') } - .to raise_error(Gitlab::Git::ConflictParser::UnmergeableFile) + .to raise_error(Gitlab::Git::Conflict::Parser::UnmergeableFile) expect { parse_text(nil) } - .to raise_error(Gitlab::Git::ConflictParser::UnmergeableFile) + .to raise_error(Gitlab::Git::Conflict::Parser::UnmergeableFile) end it 'raises UnmergeableFile when the file is over 200 KB' do expect { parse_text('a' * 204801) } - .to raise_error(Gitlab::Git::ConflictParser::UnmergeableFile) + .to raise_error(Gitlab::Git::Conflict::Parser::UnmergeableFile) end # All text from Rugged has an encoding of ASCII_8BIT, so force that in @@ -216,7 +216,7 @@ CONFLICT context 'when the file contains non-UTF-8 characters' do it 'raises UnsupportedEncoding' do expect { parse_text("a\xC4\xFC".force_encoding(Encoding::ASCII_8BIT)) } - .to raise_error(Gitlab::Git::ConflictParser::UnsupportedEncoding) + .to raise_error(Gitlab::Git::Conflict::Parser::UnsupportedEncoding) end end end diff --git a/spec/models/diff_note_spec.rb b/spec/models/diff_note_spec.rb index 67a8efa6524..9db8a61e9ca 100644 --- a/spec/models/diff_note_spec.rb +++ b/spec/models/diff_note_spec.rb @@ -105,7 +105,7 @@ describe DiffNote do describe "#line_code" do it "returns the correct line code" do - line_code = Gitlab::Git::DiffLineCode.generate(position.file_path, position.formatter.new_line, 15) + line_code = Gitlab::Git::Conflict::LineCode.generate(position.file_path, position.formatter.new_line, 15) expect(subject.line_code).to eq(line_code) end diff --git a/spec/services/merge_requests/conflicts/resolve_service_spec.rb b/spec/services/merge_requests/conflicts/resolve_service_spec.rb index 4ecd318b5b6..5376083e7f5 100644 --- a/spec/services/merge_requests/conflicts/resolve_service_spec.rb +++ b/spec/services/merge_requests/conflicts/resolve_service_spec.rb @@ -204,16 +204,16 @@ describe MergeRequests::Conflicts::ResolveService do it 'raises a ResolutionError error' do expect { service.execute(user, invalid_params) } - .to raise_error(Gitlab::Git::Merge::ResolutionError) + .to raise_error(Gitlab::Git::Conflict::Resolver::ResolutionError) end end context 'when the content of a file is unchanged' do - let(:merge) do - MergeRequests::Conflicts::ListService.new(merge_request).conflicts.merge + let(:resolver) do + MergeRequests::Conflicts::ListService.new(merge_request).conflicts.resolver end let(:regex_conflict) do - merge.conflict_for_path('files/ruby/regex.rb', 'files/ruby/regex.rb') + resolver.conflict_for_path('files/ruby/regex.rb', 'files/ruby/regex.rb') end let(:invalid_params) do @@ -235,7 +235,7 @@ describe MergeRequests::Conflicts::ResolveService do it 'raises a ResolutionError error' do expect { service.execute(user, invalid_params) } - .to raise_error(Gitlab::Git::Merge::ResolutionError) + .to raise_error(Gitlab::Git::Conflict::Resolver::ResolutionError) end end @@ -255,7 +255,7 @@ describe MergeRequests::Conflicts::ResolveService do it 'raises a ResolutionError error' do expect { service.execute(user, invalid_params) } - .to raise_error(Gitlab::Git::Merge::ResolutionError) + .to raise_error(Gitlab::Git::Conflict::Resolver::ResolutionError) end end end |