From f173d63c0ba94a40585200cae88312c47c5de791 Mon Sep 17 00:00:00 2001 From: lexisvar Date: Sat, 4 Feb 2023 01:47:47 -0500 Subject: [PATCH 1/5] add avatar movie, class, tests --- lib/faker/movies/avatar.rb | 49 ++++++++++++++++++++++++++ lib/locales/en/avatar.yml | 31 ++++++++++++++++ test/faker/movies/test_faker_avatar.rb | 21 +++++++++++ 3 files changed, 101 insertions(+) create mode 100644 lib/faker/movies/avatar.rb create mode 100644 lib/locales/en/avatar.yml create mode 100644 test/faker/movies/test_faker_avatar.rb diff --git a/lib/faker/movies/avatar.rb b/lib/faker/movies/avatar.rb new file mode 100644 index 0000000000..6dae60dc37 --- /dev/null +++ b/lib/faker/movies/avatar.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +module Faker + class Movies + class Avatar < Base + class << self + ## + # Produces a character from Avatar. + # + # @return [String] + # + # @example + # Faker::Movies::Avatar.character #=> "Jake Sully" + # + # @faker.version 3.1.1 + def character + fetch('avatar.characters') + end + + ## + # Produces a date from Avatar. + # + # @return [String] + # + # @example + # Faker::Movies::Avatar.date #=> "December 15, 2022" + # + # @faker.version 3.1.1 + def date + fetch('avatar.dates') + end + + ## + # Produces a quote from Avatar. + # + # @return [String] + # + # @example + # Faker::Movies::Avatar.quote + # #=> "If it ain't raining, we ain't training." + # + # @faker.version 3.1.1 + def quote + fetch('avatar.quotes') + end + end + end + end +end \ No newline at end of file diff --git a/lib/locales/en/avatar.yml b/lib/locales/en/avatar.yml new file mode 100644 index 0000000000..641989c228 --- /dev/null +++ b/lib/locales/en/avatar.yml @@ -0,0 +1,31 @@ +en: + faker: + avatar: + characters: ['Neytiri', 'Jake Sully, Tommy', 'Doctora Grace Augustine', 'Ronal', 'Trudy Chacon', 'Miles Quaritch', 'Dr. Karina Mogue', 'Parker Selfridge', 'Mo at', 'Eytukan', 'Dragon Gunship Pilot', 'Neteyam', 'Varang', 'Otamu', 'Bilano', 'Deyshana', 'Entok', 'Eywaftia', 'Frapohu', 'Ronal', 'Saeyla', 'Sevineyo', 'Ian Garvin', 'Hukato'] + dates: ['December 18, 2009', 'December 15, 2022', 'December 20, 2024'] + quotes: [ + "I'm a warrior of the Jarhead clan.", + "I was a warrior who dreamed he could bring peace. Sooner or later though, you always have to wake up.", + "You want a fair deal, you're on the wrong planet. The strong prey on the weak.", + "Sometimes your whole life boils down to one insane move.", + "The Sky People have sent us a message: that they can take whatever they want. That no one can stop them. Well, we will send them a message: that they cannot take whatever they want! And that this...this is our land!", + "All I ever wanted was a single thing worth fighting for.", + "You don't choose your Avatar... your Avatar chooses you.", + "The Na'vi say, that every person is born twice. The second time, is when you earn your place among the people...forever.", + "Your spirit goes with Eywa. Your body stays behind to become part of The People.", + "If it ain't raining, we ain't training.", + "I became a Marine for the hardship. To be hammered on the anvil of life. I told myself I could pass any test a man can pass.", + "If Grace is there with you - look in her memories - she can show you the world we come from. There's no green there. They killed their mother, and they're gonna do the same here.", + "Sooner or later, though, you always have to wake up.", + "Everything is backwards now, like out there is the true world, and in here is the dream.", + "I'm with you now, Jake. We are mated for life.", + "To become 'taronyu' hunter, you must choose your own Ikran and he must choose you.", + "Toruk chose him, it has only happened five times since the time of first songs.", + "You have a strong heart. No fear. But stupid! Ignorant like a child!", + "Our great mother does not take sides, Jake; she protects the balance of life.", + "Hey Sully... how does it feel to betray your own race? You think you're one of them? Time to wake up!", + "Everyone on this base, every one of you, is fighting for survival, and that's a fact.", + "And when we destroy it, we will blast a crater in their racial memory so deep, that they won't come within 1,000 klicks of this place ever again. And that too, is a fact.", + "So you just figured you'd come here, to the most hostile environment known to men, with no training of any kind, and see how it went? What was going through your head?", + "It is hard to fill a cup that is already full." + ] diff --git a/test/faker/movies/test_faker_avatar.rb b/test/faker/movies/test_faker_avatar.rb new file mode 100644 index 0000000000..08effcb7d7 --- /dev/null +++ b/test/faker/movies/test_faker_avatar.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require_relative '../../test_helper' + +class TestFakerAvatar < Test::Unit::TestCase + def setup + @tester = Faker::Movies::Avatar + end + + def test_character + assert_match(/\w+/, @tester.character) + end + + def test_date + assert_match(/\w+/, @tester.date) + end + + def test_quote + assert_match(/\w+/, @tester.quote) + end +end From 14a61121a4f2db5dcd0bcbcf620d62d132d6dce4 Mon Sep 17 00:00:00 2001 From: lexisvar Date: Sat, 4 Feb 2023 01:56:32 -0500 Subject: [PATCH 2/5] readme avatar movie --- README.md | 6 ++++++ doc/movies/avatar.md | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 doc/movies/avatar.md diff --git a/README.md b/README.md index c0961171e0..58d4de977a 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,18 @@ and it was the original impetus for the creation of this gem). ## Table of Contents - [Faker](#faker) + - [Quick links](#quick-links) + - [Table of Contents](#table-of-contents) - [Notes](#notes) - [Getting Started](#getting-started) - [Usage](#usage) + - [A note about the Generators versions](#a-note-about-the-generators-versions) - [Ensuring unique values](#ensuring-unique-values) - [Deterministic Random](#deterministic-random) - [Customization](#customization) + - [Minitest and Faker \>= 2.22](#minitest-and-faker--222) - [Generators](#generators) + - [Travel](#travel) - [Contributing](#contributing) - [Versioning](#versioning) - [License](#license) @@ -377,6 +382,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main Movies - [Faker::Movie](doc/movies/movie.md) + - [Faker::Movies::Avatar](doc/movies/avatar.md) - [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md) - [Faker::Movies::Departed](doc/movies/departed.md) - [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md) diff --git a/doc/movies/avatar.md b/doc/movies/avatar.md new file mode 100644 index 0000000000..d5f1069548 --- /dev/null +++ b/doc/movies/avatar.md @@ -0,0 +1,9 @@ +# Faker::Movies::Avatar + +```ruby +Faker::Movies::Avatar.character #=> "Miles Quaritch" + +Faker::Movies::Avatar.date #=> "December 18, 2009" + +Faker::Movies::Avatar.quote #=> "It is hard to fill a cup that is already full." +``` From 81ea9503e56a86617a94b1d813c33228d76c4ca0 Mon Sep 17 00:00:00 2001 From: lexisvar Date: Sat, 4 Feb 2023 10:26:41 -0500 Subject: [PATCH 3/5] new line --- lib/faker/movies/avatar.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/faker/movies/avatar.rb b/lib/faker/movies/avatar.rb index 6dae60dc37..c19ff7a563 100644 --- a/lib/faker/movies/avatar.rb +++ b/lib/faker/movies/avatar.rb @@ -46,4 +46,4 @@ def quote end end end -end \ No newline at end of file +end From 55f5d4c570fcefffdfd22226c7e3d642d4b49e33 Mon Sep 17 00:00:00 2001 From: lexisvar Date: Sat, 4 Feb 2023 10:27:06 -0500 Subject: [PATCH 4/5] prevent conflic with Faker::Avatar conflict --- test/faker/movies/test_faker_avatar.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/faker/movies/test_faker_avatar.rb b/test/faker/movies/test_faker_avatar.rb index 08effcb7d7..b316f25fab 100644 --- a/test/faker/movies/test_faker_avatar.rb +++ b/test/faker/movies/test_faker_avatar.rb @@ -2,7 +2,7 @@ require_relative '../../test_helper' -class TestFakerAvatar < Test::Unit::TestCase +class TestFakerMovieAvatar < Test::Unit::TestCase def setup @tester = Faker::Movies::Avatar end From f1c6c286b89ca22bbaa915e2f3cb7750f5e0ceeb Mon Sep 17 00:00:00 2001 From: lexisvar Date: Sat, 4 Feb 2023 11:12:59 -0500 Subject: [PATCH 5/5] change hardcoded version to next --- lib/faker/movies/avatar.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/faker/movies/avatar.rb b/lib/faker/movies/avatar.rb index c19ff7a563..48418118d9 100644 --- a/lib/faker/movies/avatar.rb +++ b/lib/faker/movies/avatar.rb @@ -12,7 +12,7 @@ class << self # @example # Faker::Movies::Avatar.character #=> "Jake Sully" # - # @faker.version 3.1.1 + # @faker.version next def character fetch('avatar.characters') end @@ -25,7 +25,7 @@ def character # @example # Faker::Movies::Avatar.date #=> "December 15, 2022" # - # @faker.version 3.1.1 + # @faker.version next def date fetch('avatar.dates') end @@ -39,7 +39,7 @@ def date # Faker::Movies::Avatar.quote # #=> "If it ain't raining, we ain't training." # - # @faker.version 3.1.1 + # @faker.version next def quote fetch('avatar.quotes') end