Commit 9cabe043 authored by randx's avatar randx

tests for: Profile -> History

parent 68f4b597
...@@ -20,6 +20,7 @@ class Event < ActiveRecord::Base ...@@ -20,6 +20,7 @@ class Event < ActiveRecord::Base
delegate :title, to: :issue, prefix: true, allow_nil: true delegate :title, to: :issue, prefix: true, allow_nil: true
delegate :title, to: :merge_request, prefix: true, allow_nil: true delegate :title, to: :merge_request, prefix: true, allow_nil: true
belongs_to :author, class_name: "User"
belongs_to :project belongs_to :project
belongs_to :target, polymorphic: true belongs_to :target, polymorphic: true
......
...@@ -20,3 +20,8 @@ Feature: Profile ...@@ -20,3 +20,8 @@ Feature: Profile
Given I visit profile account page Given I visit profile account page
Then I reset my token Then I reset my token
And I should see new token And I should see new token
Scenario: I visit history tab
Given I have activity
When I visit profile history page
Then I should see my activity
...@@ -41,4 +41,12 @@ class Profile < Spinach::FeatureSteps ...@@ -41,4 +41,12 @@ class Profile < Spinach::FeatureSteps
find("#token").value.should_not == @old_token find("#token").value.should_not == @old_token
find("#token").value.should == @user.reload.private_token find("#token").value.should == @user.reload.private_token
end end
Given 'I have activity' do
Factory :closed_issue_event, author: current_user
end
Then 'I should see my activity' do
page.should have_content "#{current_user.name} closed issue"
end
end end
...@@ -11,4 +11,8 @@ module SharedAuthentication ...@@ -11,4 +11,8 @@ module SharedAuthentication
Given 'I sign in as an admin' do Given 'I sign in as an admin' do
login_as :admin login_as :admin
end end
def current_user
@user || User.first
end
end end
...@@ -78,6 +78,12 @@ FactoryGirl.define do ...@@ -78,6 +78,12 @@ FactoryGirl.define do
end end
factory :event do factory :event do
factory :closed_issue_event do
project
action Event::Closed
target factory: :closed_issue
author factory: :user
end
end end
factory :key do factory :key do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment