Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Updating to avoid deprecation warnings #1

Merged
merged 3 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/data_magic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Functionality of the data_magic gem
And the value for "last_name" should be 1 word long
And the value for "name_prefix" should be 1 word long
And the value for "name_suffix" should be 1 word long
And the value for "title" should have a minimum of 3 words
And the value for "title" should have a minimum of 2 words

Scenario: Getting addresses from the yaml
Then the value for "street" should have a minimum of 2 words
Expand Down
2 changes: 2 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
require 'rspec/expectations'
require 'data_magic'

DataMagic.locale = 'en-US'

Before do
DataMagic.yml_directory = nil
DataMagic.yml = nil
Expand Down
16 changes: 8 additions & 8 deletions lib/data_magic/standard_translation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def name_suffix
# return a random title
#
def title
Faker::Name.title
Faker::Job.title
end
alias_method :dm_title, :title

#
# return a random street address
#
def street_address(include_secondary=false)
Faker::Address.street_address(include_secondary)
Faker::Address.street_address(include_secondary: include_secondary)
end
alias_method :dm_street_address, :street_address

Expand Down Expand Up @@ -144,47 +144,47 @@ def credit_card_type
# return random words - default is 3 words
#
def words(number = 3)
Faker::Lorem.words(number).join(' ')
Faker::Lorem.words(number: number).join(' ')
end
alias_method :dm_words, :words

#
# return a random sentence - default minimum word count is 4
#
def sentence(min_word_count = 4)
Faker::Lorem.sentence(min_word_count)
Faker::Lorem.sentence(word_count: min_word_count)
end
alias_method :dm_sentence, :sentence

#
# return random sentences - default is 3 sentences
#
def sentences(sentence_count = 3)
Faker::Lorem.sentences(sentence_count).join(' ')
Faker::Lorem.sentences(number: sentence_count).join(' ')
end
alias_method :dm_sentences, :sentences

#
# return random paragraphs - default is 3 paragraphs
#
def paragraphs(paragraph_count = 3)
Faker::Lorem.paragraphs(paragraph_count).join('\n\n')
Faker::Lorem.paragraphs(number: paragraph_count).join('\n\n')
end
alias_method :dm_paragraphs, :paragraphs

#
# return random characters - default is 255 characters
#
def characters(character_count = 255)
Faker::Lorem.characters(character_count)
Faker::Lorem.characters(number: character_count)
end
alias_method :dm_characters, :characters

#
# return a random email address
#
def email_address(name=nil)
Faker::Internet.email(name)
Faker::Internet.email(name: name)
end
alias_method :dm_email_address, :email_address

Expand Down