From 327546536f986030f756463ef5a4e22556141105 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 13 Sep 2017 18:16:56 +0200 Subject: Rename Gitlab::Git::Committer to User --- spec/lib/gitlab/git/committer_spec.rb | 22 ---------------------- spec/lib/gitlab/git/hooks_service_spec.rb | 8 ++++---- spec/lib/gitlab/git/user_spec.rb | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 spec/lib/gitlab/git/committer_spec.rb create mode 100644 spec/lib/gitlab/git/user_spec.rb (limited to 'spec/lib') diff --git a/spec/lib/gitlab/git/committer_spec.rb b/spec/lib/gitlab/git/committer_spec.rb deleted file mode 100644 index b0ddbb51449..00000000000 --- a/spec/lib/gitlab/git/committer_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Git::Committer do - let(:name) { 'Jane Doe' } - let(:email) { 'janedoe@example.com' } - let(:gl_id) { 'user-123' } - - subject { described_class.new(name, email, gl_id) } - - describe '#==' do - def eq_other(name, email, gl_id) - eq(described_class.new(name, email, gl_id)) - end - - it { expect(subject).to eq_other(name, email, gl_id) } - - it { expect(subject).not_to eq_other(nil, nil, nil) } - it { expect(subject).not_to eq_other(name + 'x', email, gl_id) } - it { expect(subject).not_to eq_other(name, email + 'x', gl_id) } - it { expect(subject).not_to eq_other(name, email, gl_id + 'x') } - end -end diff --git a/spec/lib/gitlab/git/hooks_service_spec.rb b/spec/lib/gitlab/git/hooks_service_spec.rb index e9c0209fe3b..d4d75b66659 100644 --- a/spec/lib/gitlab/git/hooks_service_spec.rb +++ b/spec/lib/gitlab/git/hooks_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Gitlab::Git::HooksService, seed_helper: true do - let(:committer) { Gitlab::Git::Committer.new('Jane Doe', 'janedoe@example.com', 'user-456') } + let(:user) { Gitlab::Git::User.new('Jane Doe', 'janedoe@example.com', 'user-456') } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, 'project-123') } let(:service) { described_class.new } @@ -18,7 +18,7 @@ describe Gitlab::Git::HooksService, seed_helper: true do hook = double(trigger: [true, nil]) expect(Gitlab::Git::Hook).to receive(:new).exactly(3).times.and_return(hook) - service.execute(committer, repository, @blankrev, @newrev, @ref) { } + service.execute(user, repository, @blankrev, @newrev, @ref) { } end end @@ -28,7 +28,7 @@ describe Gitlab::Git::HooksService, seed_helper: true do expect(service).not_to receive(:run_hook).with('post-receive') expect do - service.execute(committer, repository, @blankrev, @newrev, @ref) + service.execute(user, repository, @blankrev, @newrev, @ref) end.to raise_error(Gitlab::Git::HooksService::PreReceiveError) end end @@ -40,7 +40,7 @@ describe Gitlab::Git::HooksService, seed_helper: true do expect(service).not_to receive(:run_hook).with('post-receive') expect do - service.execute(committer, repository, @blankrev, @newrev, @ref) + service.execute(user, repository, @blankrev, @newrev, @ref) end.to raise_error(Gitlab::Git::HooksService::PreReceiveError) end end diff --git a/spec/lib/gitlab/git/user_spec.rb b/spec/lib/gitlab/git/user_spec.rb new file mode 100644 index 00000000000..0ebcecb26c0 --- /dev/null +++ b/spec/lib/gitlab/git/user_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe Gitlab::Git::User do + let(:name) { 'Jane Doe' } + let(:email) { 'janedoe@example.com' } + let(:gl_id) { 'user-123' } + + subject { described_class.new(name, email, gl_id) } + + describe '#==' do + def eq_other(name, email, gl_id) + eq(described_class.new(name, email, gl_id)) + end + + it { expect(subject).to eq_other(name, email, gl_id) } + + it { expect(subject).not_to eq_other(nil, nil, nil) } + it { expect(subject).not_to eq_other(name + 'x', email, gl_id) } + it { expect(subject).not_to eq_other(name, email + 'x', gl_id) } + it { expect(subject).not_to eq_other(name, email, gl_id + 'x') } + end +end -- cgit v1.2.1