user_spec.rb 841 Bytes
Newer Older
Jacob Vosmaer's avatar
Jacob Vosmaer committed
1 2
require 'spec_helper'

3
describe Gitlab::Git::User do
4
  let(:username) { 'janedo' }
Jacob Vosmaer's avatar
Jacob Vosmaer committed
5 6 7 8
  let(:name) { 'Jane Doe' }
  let(:email) { 'janedoe@example.com' }
  let(:gl_id) { 'user-123' }

9
  subject { described_class.new(username, name, email, gl_id) }
Jacob Vosmaer's avatar
Jacob Vosmaer committed
10 11

  describe '#==' do
12 13
    def eq_other(username, name, email, gl_id)
      eq(described_class.new(username, name, email, gl_id))
Jacob Vosmaer's avatar
Jacob Vosmaer committed
14 15
    end

16
    it { expect(subject).to eq_other(username, name, email, gl_id) }
Jacob Vosmaer's avatar
Jacob Vosmaer committed
17

18 19 20 21 22
    it { expect(subject).not_to eq_other(nil, nil, nil, nil) }
    it { expect(subject).not_to eq_other(username + 'x', name, email, gl_id) }
    it { expect(subject).not_to eq_other(username, name + 'x', email, gl_id) }
    it { expect(subject).not_to eq_other(username, name, email + 'x', gl_id) }
    it { expect(subject).not_to eq_other(username, name, email, gl_id + 'x') }
Jacob Vosmaer's avatar
Jacob Vosmaer committed
23 24
  end
end