Commit 9cabe04368024f44881e4269a008156f1629ab86
1 parent
68f4b597
Exists in
master
and in
4 other branches
tests for: Profile -> History
Showing
5 changed files
with
24 additions
and
0 deletions
Show diff stats
app/models/event.rb
@@ -20,6 +20,7 @@ class Event < ActiveRecord::Base | @@ -20,6 +20,7 @@ class Event < ActiveRecord::Base | ||
20 | delegate :title, to: :issue, prefix: true, allow_nil: true | 20 | delegate :title, to: :issue, prefix: true, allow_nil: true |
21 | delegate :title, to: :merge_request, prefix: true, allow_nil: true | 21 | delegate :title, to: :merge_request, prefix: true, allow_nil: true |
22 | 22 | ||
23 | + belongs_to :author, class_name: "User" | ||
23 | belongs_to :project | 24 | belongs_to :project |
24 | belongs_to :target, polymorphic: true | 25 | belongs_to :target, polymorphic: true |
25 | 26 |
features/profile/profile.feature
@@ -20,3 +20,8 @@ Feature: Profile | @@ -20,3 +20,8 @@ Feature: Profile | ||
20 | Given I visit profile account page | 20 | Given I visit profile account page |
21 | Then I reset my token | 21 | Then I reset my token |
22 | And I should see new token | 22 | And I should see new token |
23 | + | ||
24 | + Scenario: I visit history tab | ||
25 | + Given I have activity | ||
26 | + When I visit profile history page | ||
27 | + Then I should see my activity |
features/steps/profile/profile.rb
@@ -41,4 +41,12 @@ class Profile < Spinach::FeatureSteps | @@ -41,4 +41,12 @@ class Profile < Spinach::FeatureSteps | ||
41 | find("#token").value.should_not == @old_token | 41 | find("#token").value.should_not == @old_token |
42 | find("#token").value.should == @user.reload.private_token | 42 | find("#token").value.should == @user.reload.private_token |
43 | end | 43 | end |
44 | + | ||
45 | + Given 'I have activity' do | ||
46 | + Factory :closed_issue_event, author: current_user | ||
47 | + end | ||
48 | + | ||
49 | + Then 'I should see my activity' do | ||
50 | + page.should have_content "#{current_user.name} closed issue" | ||
51 | + end | ||
44 | end | 52 | end |
features/steps/shared/authentication.rb
spec/factories.rb
@@ -78,6 +78,12 @@ FactoryGirl.define do | @@ -78,6 +78,12 @@ FactoryGirl.define do | ||
78 | end | 78 | end |
79 | 79 | ||
80 | factory :event do | 80 | factory :event do |
81 | + factory :closed_issue_event do | ||
82 | + project | ||
83 | + action Event::Closed | ||
84 | + target factory: :closed_issue | ||
85 | + author factory: :user | ||
86 | + end | ||
81 | end | 87 | end |
82 | 88 | ||
83 | factory :key do | 89 | factory :key do |