diff options
| author | hukl <contact@smyck.org> | 2009-10-20 23:30:39 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-10-20 23:30:39 +0200 |
| commit | 20056a0e9b4f96680ca0c643166885f65dcd0be7 (patch) | |
| tree | a52396b8781ceacfbc33715d6b360a9bb32a77a7 /test/functional/nodes_controller_test.rb | |
| parent | 8d8b530e2c9f5e2debb2d6abb421187c31733c34 (diff) | |
allow to overwrite the original user in edit view
Diffstat (limited to 'test/functional/nodes_controller_test.rb')
| -rw-r--r-- | test/functional/nodes_controller_test.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/test/functional/nodes_controller_test.rb b/test/functional/nodes_controller_test.rb index f8d42da..8710c0b 100644 --- a/test/functional/nodes_controller_test.rb +++ b/test/functional/nodes_controller_test.rb | |||
| @@ -57,12 +57,12 @@ class NodesControllerTest < ActionController::TestCase | |||
| 57 | post( | 57 | post( |
| 58 | :create, | 58 | :create, |
| 59 | :kind => "top_level", | 59 | :kind => "top_level", |
| 60 | :title => "Hello Spaceboy" | 60 | :title => "Hello My Spaceboy" |
| 61 | ) | 61 | ) |
| 62 | end | 62 | end |
| 63 | 63 | ||
| 64 | assert_response :redirect | 64 | assert_response :redirect |
| 65 | expected = "hello-spaceboy" | 65 | expected = "hello-my-spaceboy" |
| 66 | assert_equal expected, Node.last.unique_name | 66 | assert_equal expected, Node.last.unique_name |
| 67 | assert_equal 1, Node.last.level | 67 | assert_equal 1, Node.last.level |
| 68 | end | 68 | end |
| @@ -261,6 +261,29 @@ class NodesControllerTest < ActionController::TestCase | |||
| 261 | node.publish_draft! | 261 | node.publish_draft! |
| 262 | 262 | ||
| 263 | assert Node.valid? | 263 | assert Node.valid? |
| 264 | end | ||
| 265 | |||
| 266 | test "editing the initial draft sets the author to current_user" do | ||
| 267 | login_as :quentin | ||
| 268 | Node.root.descendants.destroy_all | ||
| 269 | node = create_node_with_draft | ||
| 270 | get :edit, :id => node.id | ||
| 271 | assert_equal "quentin", node.draft.user.login | ||
| 272 | end | ||
| 273 | |||
| 274 | test "updating the author of a node with existing head" do | ||
| 275 | login_as :quentin | ||
| 276 | Node.root.descendants.destroy_all | ||
| 277 | node = create_node_with_published_page | ||
| 278 | assert_equal "quentin", node.head.user.login | ||
| 279 | node.find_or_create_draft users(:quentin) | ||
| 280 | assert node.draft.valid? | ||
| 281 | assert node.valid? | ||
| 282 | |||
| 283 | put :update, :id => node.id, :page => {:user_id => users(:aaron).id} | ||
| 284 | assert_response :redirect | ||
| 285 | assert_equal "aaron", node.reload.draft.user.login | ||
| 286 | |||
| 264 | 287 | ||
| 265 | end | 288 | end |
| 266 | end | 289 | end |
