From bb6fe7e73a96ac6a9130ed2a68a606ed5f5fb881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 29 Jan 2015 12:19:41 -0200 Subject: Consistent usage of spaces in hashes across our codebase --- guides/source/testing.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'guides') diff --git a/guides/source/testing.md b/guides/source/testing.md index 228b8d08fa..a083b3f981 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -495,13 +495,13 @@ All the keyword arguments are optional. Example: Calling the `:show` action, passing an `id` of 12 as the `params` and setting a `user_id` of 5 in the session: ```ruby -get(:show, params: {'id' => "12"}, session: {'user_id' => 5}) +get(:show, params: { 'id' => "12" }, session: { 'user_id' => 5 }) ``` Another example: Calling the `:view` action, passing an `id` of 12 as the `params`, this time with no session, but with a flash message. ```ruby -get(:view, params: {'id' => '12'}, flash: {'message' => 'booya!'}) +get(:view, params: { 'id' => '12' }, flash: { 'message' => 'booya!' }) ``` NOTE: If you try running `test_should_create_article` test from `articles_controller_test.rb` it will fail on account of the newly added model level validation and rightly so. @@ -511,7 +511,7 @@ Let us modify `test_should_create_article` test in `articles_controller_test.rb` ```ruby test "should create article" do assert_difference('Article.count') do - post :create, params: { article: {title: 'Some title'} } + post :create, params: { article: { title: 'Some title' } } end assert_redirected_to article_path(assigns(:article)) @@ -645,7 +645,7 @@ Let's start by adding this assertion to our `test_should_create_article` test: ```ruby test "should create article" do assert_difference('Article.count') do - post :create, params: { article: {title: 'Some title'} } + post :create, params: { article: { title: 'Some title' } } end assert_redirected_to article_path(assigns(:article)) @@ -740,7 +740,7 @@ We can also add a test for updating an existing Article. ```ruby test "should update article" do article = articles(:one) - patch :update, params: { id: article.id, article: {title: "updated"} } + patch :update, params: { id: article.id, article: { title: "updated" } } assert_redirected_to article_path(assigns(:article)) end ``` @@ -779,7 +779,7 @@ class ArticlesControllerTest < ActionController::TestCase end test "should update article" do - patch :update, params: { id: @article.id, article: {title: "updated"} } + patch :update, params: { id: @article.id, article: { title: "updated" } } assert_redirected_to article_path(assigns(:article)) end end @@ -1034,7 +1034,7 @@ test "can create an article" do assert_template "articles/new", partial: "articles/_form" post "/articles", - params: { article: {title: "can create", body: "article successfully."} } + params: { article: { title: "can create", body: "article successfully." } } assert_response :redirect follow_redirect! assert_response :success @@ -1051,7 +1051,7 @@ After this we make a post request to the `:create` action of our Articles contro ```ruby post "/articles", - params: { article: {title: "can create", body: "article successfully."} } + params: { article: { title: "can create", body: "article successfully." } } assert_response :redirect follow_redirect! ``` -- cgit v1.2.3