From 43afe46bbd19b1edf60abf3f104fb2b0d29af564 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 22 Mar 2015 13:55:00 -0700 Subject: Refactor contributions events and write tests for calendar --- features/steps/user.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'features/steps/user.rb') diff --git a/features/steps/user.rb b/features/steps/user.rb index d6f05ecb2c7..e6086bfc1c9 100644 --- a/features/steps/user.rb +++ b/features/steps/user.rb @@ -7,4 +7,39 @@ class Spinach::Features::User < Spinach::FeatureSteps step 'I should see user "John Doe" page' do expect(title).to match(/^\s*John Doe/) end + + step '"John Doe" has contributions' do + user = User.find_by(name: 'John Doe') + project = contributed_project + + # Issue controbution + issue_params = { title: 'Bug in old browser' } + Issues::CreateService.new(project, user, issue_params).execute + + # Push code contribution + push_params = { + project: project, + action: Event::PUSHED, + author_id: user.id, + data: { commit_count: 3 } + } + + Event.create(push_params) + end + + step 'I should see contributed projects' do + within '.contributed-projects' do + page.should have_content(@contributed_project.name) + end + end + + step 'I should see contributions calendar' do + within '.calendar' do + page.should have_css('.graph-rect.r2.q2') + end + end + + def contributed_project + @contributed_project ||= create(:project, :public) + end end -- cgit v1.2.1 From 54aca18cf856a18bdd121a3db25d2a64b9e0844d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 22 Mar 2015 14:35:27 -0700 Subject: Contribution calendar will use events instead of commits to count contributions --- features/steps/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features/steps/user.rb') diff --git a/features/steps/user.rb b/features/steps/user.rb index e6086bfc1c9..5939c28a000 100644 --- a/features/steps/user.rb +++ b/features/steps/user.rb @@ -35,7 +35,7 @@ class Spinach::Features::User < Spinach::FeatureSteps step 'I should see contributions calendar' do within '.calendar' do - page.should have_css('.graph-rect.r2.q2') + page.should have_css('.graph-rect.r3.q3') end end -- cgit v1.2.1 From b449bc5b77aa658db67ebcb25f709fe51c29b129 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 22 Mar 2015 19:47:23 -0700 Subject: Improve user calendar test --- features/steps/user.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'features/steps/user.rb') diff --git a/features/steps/user.rb b/features/steps/user.rb index 5939c28a000..10cae692a88 100644 --- a/features/steps/user.rb +++ b/features/steps/user.rb @@ -34,9 +34,7 @@ class Spinach::Features::User < Spinach::FeatureSteps end step 'I should see contributions calendar' do - within '.calendar' do - page.should have_css('.graph-rect.r3.q3') - end + page.should have_css('.cal-heatmap-container') end def contributed_project -- cgit v1.2.1