think_feel_do_dashboard 1.1.14 → 1.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/think_feel_do_dashboard/arms_controller.rb +19 -1
- data/app/models/think_feel_do_dashboard/concerns/group.rb +10 -17
- data/lib/think_feel_do_dashboard/version.rb +1 -1
- data/spec/controllers/think_feel_do_dashboard/arms_controller_spec.rb +72 -0
- data/spec/dummy/log/test.log +36621 -0
- data/spec/models/group_spec.rb +47 -17
- metadata +2 -2
data/spec/models/group_spec.rb
CHANGED
@@ -72,27 +72,57 @@ describe Group do
|
|
72
72
|
expect(moderating_participant.errors.full_messages.include?("Is admin can't be destroyed.")).to be_truthy
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
75
|
+
describe "saving" do
|
76
|
+
let(:invalid_group) do
|
77
|
+
Group.new(
|
78
|
+
arm_id: social_arm.id,
|
79
|
+
moderator_id: clinician2.id,
|
80
|
+
title: "Test")
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "when invalid" do
|
84
|
+
before do
|
85
|
+
allow_any_instance_of(Participant)
|
86
|
+
.to receive(:valid?) { false }
|
87
|
+
end
|
88
|
+
|
89
|
+
it "moderator is not created" do
|
90
|
+
expect { invalid_group.save! }
|
91
|
+
.to raise_error(ActiveRecord::RecordInvalid)
|
92
|
+
expect { invalid_group.save }
|
93
|
+
.to_not change { Membership.count }
|
94
|
+
expect { invalid_group.save }
|
95
|
+
.to_not change { Participant.count }
|
96
|
+
expect { invalid_group.save }
|
97
|
+
.to_not change { SocialNetworking::Profile.count }
|
98
|
+
end
|
99
|
+
end
|
87
100
|
end
|
88
101
|
|
89
|
-
|
90
|
-
|
102
|
+
describe ".create" do
|
103
|
+
let(:valid_group) do
|
104
|
+
Group.create!(
|
105
|
+
arm_id: social_arm.id,
|
106
|
+
moderator_id: clinician2.id,
|
107
|
+
title: "Test")
|
108
|
+
end
|
91
109
|
|
92
|
-
|
110
|
+
before do
|
111
|
+
valid_group.reload
|
112
|
+
end
|
113
|
+
|
114
|
+
it "sets a participant to be active almost a year later" do
|
115
|
+
Timecop.travel Time.zone.today.advance(days: 365) do
|
116
|
+
expect(valid_group.moderating_participant)
|
117
|
+
.to_not be_nil
|
118
|
+
end
|
119
|
+
end
|
93
120
|
|
94
|
-
|
95
|
-
|
121
|
+
it "sets a participant to be inactive a year later" do
|
122
|
+
Timecop.travel Time.zone.today.advance(days: 366) do
|
123
|
+
expect(valid_group.moderating_participant)
|
124
|
+
.to be_nil
|
125
|
+
end
|
96
126
|
end
|
97
127
|
end
|
98
128
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: think_feel_do_dashboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Carty-Fickes
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-04-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|