saucy 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
0.8.2
|
2
|
+
|
3
|
+
Added a uniqueness validation and database constraint for member_id/project_id on permissions. This prevents somebody from being added to the same project twice, which would display it multiple times in the project index and dropdown. When upgrading, make sure this index is in place:
|
4
|
+
|
5
|
+
remove_index :permissions, :name => [:membership_and_project]
|
6
|
+
add_index :permissions, [:membership_id, :project_id], :name => [:membership_and_project], :unique => true
|
7
|
+
|
8
|
+
You'll need to make sure that no existing duplicates exist before applying the unique index.
|
9
|
+
|
10
|
+
0.8.1
|
11
|
+
|
12
|
+
Fixed a missing translation key.
|
13
|
+
|
1
14
|
0.8.0
|
2
15
|
|
3
16
|
Added a notification for trials that just ended. When upgrading, you'll need to
|
data/app/models/permission.rb
CHANGED
@@ -55,7 +55,7 @@ class CreateSaucyTables < ActiveRecord::Migration
|
|
55
55
|
end
|
56
56
|
|
57
57
|
add_index :permissions, [:user_id, :project_id]
|
58
|
-
add_index :permissions, [:membership_id, :project_id], :name => [:membership_and_project]
|
58
|
+
add_index :permissions, [:membership_id, :project_id], :name => [:membership_and_project], :unique => true
|
59
59
|
|
60
60
|
create_table :projects do |table|
|
61
61
|
table.string :name
|
@@ -5,10 +5,21 @@ describe Permission do
|
|
5
5
|
it { should belong_to(:membership) }
|
6
6
|
it { should belong_to(:user) }
|
7
7
|
|
8
|
+
it "doesn't allow the same member to be added to a project twice" do
|
9
|
+
original = Factory(:permission)
|
10
|
+
duplicate = Factory.build(:permission, :membership => original.membership, :project => original.project)
|
11
|
+
duplicate.should_not be_valid
|
12
|
+
end
|
13
|
+
|
14
|
+
it "allows different members to be added to a project" do
|
15
|
+
original = Factory(:permission)
|
16
|
+
duplicate = Factory.build(:permission, :project => original.project)
|
17
|
+
duplicate.should be_valid
|
18
|
+
end
|
19
|
+
|
8
20
|
it "caches the user from the account membership" do
|
9
21
|
membership = Factory(:membership)
|
10
|
-
permission = Factory(:permission,
|
11
|
-
:membership => membership)
|
22
|
+
permission = Factory(:permission, :membership => membership)
|
12
23
|
permission.user_id.should == membership.user_id
|
13
24
|
end
|
14
25
|
|
data/spec/models/project_spec.rb
CHANGED
@@ -171,29 +171,29 @@ describe Project, "assigning users on update" do
|
|
171
171
|
subject { Factory(:project) }
|
172
172
|
|
173
173
|
let(:account) { subject.account }
|
174
|
-
let!(:
|
175
|
-
let!(:
|
174
|
+
let!(:user_to_remove) { Factory(:user) }
|
175
|
+
let!(:user_to_add) { Factory(:user) }
|
176
176
|
let!(:admin) { Factory(:user) }
|
177
177
|
|
178
178
|
before do
|
179
|
-
|
180
|
-
Factory(:membership, :account => account, :user =>
|
181
|
-
|
182
|
-
Factory(:membership, :account => account, :user =>
|
179
|
+
membership_to_remove =
|
180
|
+
Factory(:membership, :account => account, :user => user_to_remove)
|
181
|
+
membership_to_add =
|
182
|
+
Factory(:membership, :account => account, :user => user_to_add)
|
183
183
|
admin_membership =
|
184
184
|
Factory(:membership, :account => account, :user => admin, :admin => true)
|
185
|
-
Factory(:permission, :membership =>
|
185
|
+
Factory(:permission, :membership => membership_to_remove,
|
186
186
|
:project => subject)
|
187
187
|
|
188
|
-
subject.reload.update_attributes!(:user_ids => [
|
188
|
+
subject.reload.update_attributes!(:user_ids => [user_to_add.id, ""])
|
189
189
|
end
|
190
190
|
|
191
191
|
it "adds an added user" do
|
192
|
-
|
192
|
+
user_to_add.should be_member_of(subject)
|
193
193
|
end
|
194
194
|
|
195
195
|
it "removes a removed user" do
|
196
|
-
|
196
|
+
user_to_remove.should_not be_member_of(subject)
|
197
197
|
end
|
198
198
|
|
199
199
|
it "keeps an admin" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saucy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 2
|
10
|
+
version: 0.8.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot, inc.
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-
|
21
|
+
date: 2011-06-07 00:00:00 -04:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|