summaryrefslogtreecommitdiff
path: root/test/functional/nodes_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/nodes_controller_test.rb')
-rw-r--r--test/functional/nodes_controller_test.rb70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb
index 7559869..08e50fd 100644
--- a/test/functional/nodes_controller_test.rb
+++ b/test/functional/nodes_controller_test.rb
@@ -127,4 +127,74 @@ class NodesControllerTest < ActionController::TestCase
127 assert_equal "There", test_node.draft.body 127 assert_equal "There", test_node.draft.body
128 assert_equal "Foobar", test_node.draft.template_name 128 assert_equal "Foobar", test_node.draft.template_name
129 end 129 end
130
131
132 test "publish draft with staged_slug unqueal slug" do
133 login_as :quentin
134
135 test_node = Node.create! :slug => "test_node", :staged_slug => "peter_pan"
136 test_node.move_to_child_of Node.root
137
138 put :publish, :id => test_node.id
139
140 test_node.reload
141 assert_equal "peter_pan", test_node.slug
142 assert_equal "peter_pan", test_node.unique_name
143 end
144
145 test "publish draft with staged_slug with more levels of nodes" do
146 login_as :quentin
147
148 test_node = Node.create! :slug => "test_node", :staged_slug => "peter_pan"
149 test_node.move_to_child_of Node.root
150 test_node2 = Node.create! :slug => "test_node2"
151 test_node2.move_to_child_of test_node
152
153 put :publish, :id => test_node.id
154
155 test_node.reload; test_node2.reload
156 assert_equal "peter_pan/test_node2", test_node2.unique_name
157 assert_equal "peter_pan", test_node.unique_name
158 end
159
160 test "publish draft with staged_parent_id" do
161 login_as :quentin
162
163 parent = Node.create! :slug => "parent"
164 parent.move_to_child_of Node.root
165 test_node = Node.create! :slug => "test_node", :staged_parent_id => parent.id
166 test_node.move_to_child_of Node.root
167 test_node2 = Node.create! :slug => "test_node2"
168 test_node2.move_to_child_of test_node
169
170 put :publish, :id => test_node.id
171
172 test_node.reload; test_node2.reload
173 assert_equal "parent/test_node", test_node.unique_name
174 assert_equal "parent/test_node/test_node2", test_node2.unique_name
175 end
176
177 test "publish draft with staged_parent_id and staged_slug" do
178 login_as :quentin
179
180 parent = Node.create! :slug => "parent"
181 parent.move_to_child_of Node.root
182
183 test_node = Node.create!(
184 :slug => "test_node",
185 :staged_parent_id => parent.id,
186 :staged_slug => "peter_pan"
187 )
188 test_node.move_to_child_of Node.root
189
190 test_node2 = Node.create! :slug => "test_node2"
191 test_node2.move_to_child_of test_node
192
193 put :publish, :id => test_node.id
194
195 test_node.reload; test_node2.reload
196 assert_equal "parent/peter_pan", test_node.unique_name
197 assert_equal "parent/peter_pan/test_node2", test_node2.unique_name
198 end
199
130end 200end