summaryrefslogtreecommitdiff
path: root/test/models/user_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/models/user_test.rb')
-rw-r--r--test/models/user_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/models/user_test.rb b/test/models/user_test.rb
index feccce25..9942385c 100644
--- a/test/models/user_test.rb
+++ b/test/models/user_test.rb
@@ -126,6 +126,22 @@ class UserTest < ActiveSupport::TestCase
126 126
127 assert user.update(:email => "quentin@example.org") 127 assert user.update(:email => "quentin@example.org")
128 end 128 end
129
130 test "may_change_live? gates restricted subjects on the redaktion role" do
131 editor = User.create!(:login => "gate_editor", :email => "ge@example.com",
132 :password => "secret", :password_confirmation => "secret")
133 redaktion = User.create!(:login => "gate_red", :email => "gr@example.com",
134 :password => "secret", :password_confirmation => "secret",
135 :roles => ["redaktion"])
136
137 restricted = Node.root
138 plain = Node.root.children.create!(:slug => "gate_plain")
139
140 assert editor.may_change_live?(plain)
141 assert_not editor.may_change_live?(restricted)
142 assert redaktion.may_change_live?(plain)
143 assert redaktion.may_change_live?(restricted)
144 end
129 145
130protected 146protected
131 def create_user(options = {}) 147 def create_user(options = {})