summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-23 16:40:55 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-23 16:40:55 +0000
commite24da35984c13132e204ff923e4b75600ebed56e (patch)
tree73c373598b5b5a97df452adcaa6496b3aed223a0 /spec
parent3ca34bb8f0fa4fa3a40e9ccc44cd5d8784f30c7d (diff)
parentb449bc5b77aa658db67ebcb25f709fe51c29b129 (diff)
downloadgitlab-ce-e24da35984c13132e204ff923e4b75600ebed56e.tar.gz
Merge branch 'improve-contributions-calendar' into 'master'
Replace commits calendar with contributions calendar * count opening of issues and merge requests * dont trigger git repository - use events from database * count pushes instead of commits for faster and easier counting * much-much faster since does not affected by repository size See merge request !420
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/users_controller_spec.rb21
-rw-r--r--spec/models/repository_spec.rb45
2 files changed, 11 insertions, 55 deletions
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 7962bcdde71..d47a37914df 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -25,34 +25,21 @@ describe UsersController do
end
describe 'GET #calendar_activities' do
- include RepoHelpers
- let(:project) { create(:project) }
- let(:calendar_user) { create(:user, email: sample_commit.author_email) }
- let(:commit1) { '0ed8c6c6752e8c6ea63e7b92a517bf5ac1209c80' }
- let(:commit2) { '7d3b0f7cff5f37573aea97cebfd5692ea1689924' }
+ let!(:project) { create(:project) }
+ let!(:user) { create(:user) }
before do
allow_any_instance_of(User).to receive(:contributed_projects_ids).and_return([project.id])
project.team << [user, :developer]
end
- it 'assigns @commit_count' do
- get :calendar_activities, username: calendar_user.username, date: '2014-07-31'
- expect(assigns(:commit_count)).to eq(2)
- end
-
it 'assigns @calendar_date' do
- get :calendar_activities, username: calendar_user.username, date: '2014-07-31'
+ get :calendar_activities, username: user.username, date: '2014-07-31'
expect(assigns(:calendar_date)).to eq(Date.parse('2014-07-31'))
end
- it 'assigns @calendar_activities' do
- get :calendar_activities, username: calendar_user.username, date: '2014-07-31'
- expect(assigns(:calendar_activities).values.flatten.map(&:id)).to eq([commit1, commit2])
- end
-
it 'renders calendar_activities' do
- get :calendar_activities, username: calendar_user.username
+ get :calendar_activities, username: user.username
expect(response).to render_template('calendar_activities')
end
end
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