tests for: Profile -> History

This commit is contained in:
randx 2012-09-27 23:23:11 +03:00
parent 68f4b59738
commit 9cabe04368
5 changed files with 24 additions and 0 deletions

View file

@ -20,6 +20,7 @@ class Event < ActiveRecord::Base
delegate :title, to: :issue, 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 :target, polymorphic: true

View file

@ -20,3 +20,8 @@ Feature: Profile
Given I visit profile account page
Then I reset my 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

View file

@ -41,4 +41,12 @@ class Profile < Spinach::FeatureSteps
find("#token").value.should_not == @old_token
find("#token").value.should == @user.reload.private_token
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

View file

@ -11,4 +11,8 @@ module SharedAuthentication
Given 'I sign in as an admin' do
login_as :admin
end
def current_user
@user || User.first
end
end

View file

@ -78,6 +78,12 @@ FactoryGirl.define do
end
factory :event do
factory :closed_issue_event do
project
action Event::Closed
target factory: :closed_issue
author factory: :user
end
end
factory :key do