Skip to content

Commit

Permalink
Fix Faker syntax
Browse files Browse the repository at this point in the history
Version 2 of Faker has several breaking changes. One that affects us is
this:

`Faker::Lorem.characters(char_count = nil)`
becomes
`Faker::Lorem.characters(number: nil)`
  • Loading branch information
Alan Gabbianelli committed Aug 6, 2019
1 parent 98ec26e commit edfb19e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/integration/document_collection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DocumentCollectionTest < ActionDispatch::IntegrationTest

test "document collection with no body and 2 collection groups where 1st group has long body" do
content_item = get_content_example('document_collection')
content_item['details']['collection_groups'][0]['body'] = Faker::Lorem.characters(416)
content_item['details']['collection_groups'][0]['body'] = Faker::Lorem.characters(number: 416)
content_store_has_item(content_item['base_path'], content_item.to_json)
visit(content_item['base_path'])

Expand Down
4 changes: 2 additions & 2 deletions test/integration/topical_event_about_page_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def topical_event_end_date

def long_first_item_body
"<div class='govspeak'><h2 id='response-in-the-uk'>Item 1</h2>
<p>#{Faker::Lorem.characters(200)}</p>
<p>#{Faker::Lorem.characters(216)}</p>
<p>#{Faker::Lorem.characters(number: 200)}</p>
<p>#{Faker::Lorem.characters(number: 216)}</p>
<h2 id='response-in-africa'>Item 2</h2>
<p>#{Faker::Lorem.sentence}</p></div>"
end
Expand Down
22 changes: 11 additions & 11 deletions test/presenters/content_item/contents_list_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def body
class << @contents_list
def body
"<h2 id='one'>One</h2>
<p>#{Faker::Lorem.characters(220)}</p>
<p>#{Faker::Lorem.characters(196)}</p>
<p>#{Faker::Lorem.characters(number: 220)}</p>
<p>#{Faker::Lorem.characters(number: 196)}</p>
<h2 id='two'>Two</h2>
<p>#{Faker::Lorem.sentence}</p>"
end
Expand All @@ -96,13 +96,13 @@ def body
class << @contents_list
def body
"<h2 id='one'>One</h2>
<p>#{Faker::Lorem.characters(40)}</p>
<p>#{Faker::Lorem.characters(number: 40)}</p>
<ul>
<li>#{Faker::Lorem.characters(100)}</li>
<li>#{Faker::Lorem.characters(100)}</li>
<li>#{Faker::Lorem.characters(200)}</li>
<li>#{Faker::Lorem.characters(number: 100)}</li>
<li>#{Faker::Lorem.characters(number: 100)}</li>
<li>#{Faker::Lorem.characters(number: 200)}</li>
</ul>
<p>#{Faker::Lorem.characters(40)}</p>
<p>#{Faker::Lorem.characters(number: 40)}</p>
<h2 id='two'>Two</h2>
<p>#{Faker::Lorem.sentence}</p>"
end
Expand All @@ -129,8 +129,8 @@ def body
class << @contents_list
def body
"<h2 id='one'>One</h2>
<p>#{Faker::Lorem.characters(10)}</p>
<p>#{Faker::Lorem.characters(10)}</p>
<p>#{Faker::Lorem.characters(number: 10)}</p>
<p>#{Faker::Lorem.characters(number: 10)}</p>
<h2 id='two'>Two</h2>
<p>#{Faker::Lorem.sentence}</p>"
end
Expand Down Expand Up @@ -168,7 +168,7 @@ class << @contents_list
def body
"<h2 id='one'>One</h2>
<div class='img'><img src='www.gov.uk/img.png'></div>
<p>#{Faker::Lorem.characters(225)}</p>
<p>#{Faker::Lorem.characters(number: 225)}</p>
<h2 id='two'>Two</h2>
<p>#{Faker::Lorem.sentence}</p>"
end
Expand All @@ -193,7 +193,7 @@ def body
test "#show_contents_list? returns true if body is over 415 characters and has no h2s present" do
class << @contents_list
def body
"<div><p>#{Faker::Lorem.characters(416)}</p></div>"
"<div><p>#{Faker::Lorem.characters(number: 416)}</p></div>"
end
end
@contents_list.stubs(:contents_items).returns(["item 1", "item2"])
Expand Down

0 comments on commit edfb19e

Please sign in to comment.