Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCallum Dryden <callum.dryden@rightscale.com>2016-10-06 18:19:27 +0300
committerCallum Dryden <callum.dryden@rightscale.com>2016-10-20 03:26:45 +0300
commit9124310f2871117acaac98781be84c9fc016e2ad (patch)
tree3bb94c532a5f52dc27f483ab6de0a829f6831c19 /spec/models/members
parentc08435e3c25f0a7a705ed8a49b16dde176b41a40 (diff)
Differentiate the expire from leave event
At the moment we cannot see weather a user left a project due to their membership expiring of if they themselves opted to leave the project. This adds a new event type that allows us to make this differentiation. Note that is not really feasable to go back and reliably fix up the previous events. As a result the events for previous expire removals will remain the same however events of this nature going forward will be correctly represented.
Diffstat (limited to 'spec/models/members')
-rw-r--r--spec/models/members/project_member_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/models/members/project_member_spec.rb b/spec/models/members/project_member_spec.rb
index d85a1c1e3b2..b2fe96e2e02 100644
--- a/spec/models/members/project_member_spec.rb
+++ b/spec/models/members/project_member_spec.rb
@@ -54,6 +54,17 @@ describe ProjectMember, models: true do
master_todos
end
+ it "creates an expired event when left due to expiry" do
+ expired = create(:project_member, project: project, expires_at: Time.now - 6.days)
+ expired.destroy
+ expect(Event.first.action).to eq(Event::EXPIRED)
+ end
+
+ it "creates a left event when left due to leave" do
+ master.destroy
+ expect(Event.first.action).to eq(Event::LEFT)
+ end
+
it "destroys itself and delete associated todos" do
expect(owner.user.todos.size).to eq(2)
expect(master.user.todos.size).to eq(3)