From 626bcabf38fbf28493fbcbded451f8044928b1a1 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 14 Apr 2021 04:39:30 +1000 Subject: [PATCH] chore: fix grammar and spelling --- README.md | 6 +++--- test/jbuilder_dependency_tracker_test.rb | 2 +- test/jbuilder_test.rb | 2 +- test/scaffold_api_controller_generator_test.rb | 2 +- test/scaffold_controller_generator_test.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e3655e62..61c1371f 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ company.to_builder.target! ``` You can either use Jbuilder stand-alone or directly as an ActionView template -language. When required in Rails, you can create views a la show.json.jbuilder +language. When required in Rails, you can create views à la show.json.jbuilder (the json is already yielded): ``` ruby @@ -183,7 +183,7 @@ json.partial! partial: 'posts/post', collection: @posts, as: :post json.comments @post.comments, partial: 'comments/comment', as: :comment ``` -The `as: :some_symbol` is used with partials. It will take care of mapping the passed in object to a variable for the partial. If the value is a collection (either implicitly or explicitly by using the `collection:` option, then each value of the collection is passed to the partial as the variable `some_symbol`. If the value is a singular object, then the object is passed to the partial as the variable `some_symbol`. +The `as: :some_symbol` is used with partials. It will take care of mapping the passed in object to a variable for the partial. If the value is a collection either implicitly or explicitly by using the `collection:` option, then each value of the collection is passed to the partial as the variable `some_symbol`. If the value is a singular object, then the object is passed to the partial as the variable `some_symbol`. Be sure not to confuse the `as:` option to mean nesting of the partial. For example: @@ -193,7 +193,7 @@ Be sure not to confuse the `as:` option to mean nesting of the partial. For exam json.partial! @comment, as: :comment ``` -is quite different than: +is quite different from: ```ruby # comment attributes are nested under a "comment" property diff --git a/test/jbuilder_dependency_tracker_test.rb b/test/jbuilder_dependency_tracker_test.rb index b03fe696..d89be37a 100644 --- a/test/jbuilder_dependency_tracker_test.rb +++ b/test/jbuilder_dependency_tracker_test.rb @@ -61,7 +61,7 @@ def track_dependencies(source) assert_equal %w[comments/comment], dependencies end - test 'detects explicit depedency' do + test 'detects explicit dependency' do dependencies = track_dependencies <<-RUBY # Template Dependency: path/to/partial json.foo 'bar' diff --git a/test/jbuilder_test.rb b/test/jbuilder_test.rb index d3b37fce..76569bb6 100644 --- a/test/jbuilder_test.rb +++ b/test/jbuilder_test.rb @@ -312,7 +312,7 @@ class JbuilderTest < ActiveSupport::TestCase assert_equal 'world', result['comments'].second['content'] end - test 'nesting multiple chilren from a non-Enumerable that responds to #map with inline loop' do + test 'nesting multiple children from a non-Enumerable that responds to #map with inline loop' do comments = NonEnumerable.new([ Comment.new('hello', 1), Comment.new('world', 2) ]) result = jbuild do |json| diff --git a/test/scaffold_api_controller_generator_test.rb b/test/scaffold_api_controller_generator_test.rb index 02ed7af4..2c8f8ef8 100644 --- a/test/scaffold_api_controller_generator_test.rb +++ b/test/scaffold_api_controller_generator_test.rb @@ -47,7 +47,7 @@ class ScaffoldApiControllerGeneratorTest < Rails::Generators::TestCase end end - test 'dont use require and permit if there are no attributes' do + test "don't use require and permit if there are no attributes" do run_generator %w(Post --api) assert_file 'app/controllers/posts_controller.rb' do |content| diff --git a/test/scaffold_controller_generator_test.rb b/test/scaffold_controller_generator_test.rb index 452ad842..f3783007 100644 --- a/test/scaffold_controller_generator_test.rb +++ b/test/scaffold_controller_generator_test.rb @@ -59,7 +59,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase end end - test 'dont use require and permit if there are no attributes' do + test "don't use require and permit if there are no attributes" do run_generator %w(Post) assert_file 'app/controllers/posts_controller.rb' do |content|