summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@gmail.com>2014-07-17 23:22:40 +0200
committerCiro Santilli <ciro.santilli@gmail.com>2014-07-17 23:22:40 +0200
commite1d307bf4b88afa59d851918c29ffbb61b01e8c5 (patch)
tree563be912ec72d7af1b37f136492b1da59406e103
parent1591467655b6045108f88e8ac2d8b6a069ef4bb1 (diff)
downloadgitlab-ce-e1d307bf4b88afa59d851918c29ffbb61b01e8c5.tar.gz
Move destroy user feature to spec.
-rw-r--r--features/project/star.feature10
-rw-r--r--features/steps/shared/user.rb5
-rw-r--r--spec/models/project_spec.rb17
3 files changed, 14 insertions, 18 deletions
diff --git a/features/project/star.feature b/features/project/star.feature
index e6cbc78125b..d8d898155fe 100644
--- a/features/project/star.feature
+++ b/features/project/star.feature
@@ -36,13 +36,3 @@ Feature: Project Star
And I visit project "Community" page
When I click on the star toggle button
Then The project has 2 stars
-
- @javascript
- Scenario: If an user deletes his account his stars are destroyed
- Given I sign in as "John Doe"
- And public project "Community"
- And I visit project "Community" page
- And I click on the star toggle button
- And I delete my account
- When I visit project "Community" page
- Then The project has 0 stars
diff --git a/features/steps/shared/user.rb b/features/steps/shared/user.rb
index f52551c9dc7..209d77c7acf 100644
--- a/features/steps/shared/user.rb
+++ b/features/steps/shared/user.rb
@@ -9,11 +9,6 @@ module SharedUser
user_exists("Mary Jane", {username: "mary_jane"})
end
- step "I delete my account" do
- visit profile_account_path
- click_link "Delete account"
- end
-
protected
def user_exists(name, options = {})
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 72673a1f812..bc537b7312b 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -241,8 +241,8 @@ describe Project do
it { project.open_branches.map(&:name).should_not include('master') }
end
- describe "#star_count" do
- it "counts stars from multiple users" do
+ describe '#star_count' do
+ it 'counts stars from multiple users' do
user1 = create :user
user2 = create :user
project = create :project, :public
@@ -265,7 +265,7 @@ describe Project do
expect(project.reload.star_count).to eq(0)
end
- it "counts stars on the right project" do
+ it 'counts stars on the right project' do
user = create :user
project1 = create :project, :public
project2 = create :project, :public
@@ -297,5 +297,16 @@ describe Project do
expect(project1.star_count).to eq(0)
expect(project2.star_count).to eq(0)
end
+
+ it 'is decremented when an upvoter account is deleted' do
+ user = create :user
+ project = create :project, :public
+ user.toggle_star(project)
+ project.reload
+ expect(project.star_count).to eq(1)
+ user.destroy
+ project.reload
+ expect(project.star_count).to eq(0)
+ end
end
end