diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-22 11:01:45 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-22 11:01:45 -0700 |
commit | 9c6086bc956a3fa57cb71eab744847b0206109e2 (patch) | |
tree | b94f8823e6340d47feffb32c8d61abd132b4b304 /spec | |
parent | 64891c6c40c6b670c2b50aab8ba56e3d47e30076 (diff) | |
download | gitlab-ce-9c6086bc956a3fa57cb71eab744847b0206109e2.tar.gz |
Refactor repository specs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/repository_spec.rb | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 0e3e0b167d7..f41e5a97ca3 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -13,47 +13,16 @@ describe Repository do it { is_expected.not_to include('fix') } end - describe :last_commit_for_path do - subject { repository.last_commit_for_path(sample_commit.id, '.gitignore').id } - - it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') } - end - - context :timestamps_by_user_log do - before do - Date.stub(:today).and_return(Date.new(2015, 03, 01)) - end - - describe 'single e-mail for user' do - let(:user) { create(:user, email: sample_commit.author_email) } - - subject { repository.timestamps_by_user_log(user) } + describe :tag_names_contains do + subject { repository.tag_names_contains(sample_commit.id) } - it { is_expected.to eq(['2014-08-06', '2014-07-31', '2014-07-31']) } - end - - describe 'multiple emails for user' do - let(:email_alias) { create(:email, email: another_sample_commit.author_email) } - let(:user) { create(:user, email: sample_commit.author_email, emails: [email_alias]) } - - subject { repository.timestamps_by_user_log(user) } - - it { is_expected.to eq(['2015-01-10', '2014-08-06', '2014-07-31', '2014-07-31']) } - end + it { is_expected.to include('v1.1.0') } + it { is_expected.not_to include('v1.0.0') } end - context :commits_by_user_on_date_log do - - describe 'single e-mail for user' do - let(:user) { create(:user, email: sample_commit.author_email) } - let(:commit1) { '0ed8c6c6752e8c6ea63e7b92a517bf5ac1209c80' } - let(:commit2) { '7d3b0f7cff5f37573aea97cebfd5692ea1689924' } - - subject { repository.commits_by_user_on_date_log(user,Date.new(2014, 07, 31)) } + describe :last_commit_for_path do + subject { repository.last_commit_for_path(sample_commit.id, '.gitignore').id } - it 'contains the exepected commits' do - expect(subject.flatten.map(&:id)).to eq([commit1, commit2]) - end - end + it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') } end end |