Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add Faker::WorldCup #1265

Merged
merged 33 commits into from
Jun 2, 2018
Merged

Add Faker::WorldCup #1265

merged 33 commits into from
Jun 2, 2018

Conversation

snayrouz
Copy link
Contributor

@snayrouz snayrouz commented Jun 2, 2018

I'm having an issue when I run bundle exec rake
I receive a "rake aborted" notification and a lot of failing tests.
I'm wondering if someone could take a look at this so I can run my tests. @olleolleolle @robbyrussell @garyharan @steveh @probablycorey

Copy link
Member

@vbrazo vbrazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing 🥇

You locales are invalid, you should remove the ,

group_A: ["Egypt", "Russia", "Saudi Arabia", "Uruguay"],

@vbrazo vbrazo changed the title Fifa 2018 Add Faker::WorldCup Jun 2, 2018
Copy link
Member

@vbrazo vbrazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things that need to be done before merging:

  • create a doc/world_cup.md. Check other files in this folder out.
  • update readme.md and add the world_cup in the menu

Even though I fixed your locales and the multiple crashes, there are a few tests in the test_faker_world_cup.rb that are failing, so I'd recommend you pulling my changes and see what's going on.

We're using rubocop, so make sure to run bundle exec rubocop -a to autocorrect the rubocop violations before pushing.

@vbrazo
Copy link
Member

vbrazo commented Jun 2, 2018

@snayrouz I opened a console by running rake console. Your methods are not working properly.

Do that and run:

  • Faker::WorldCup.group
  • Faker::WorldCup.roster

Faker::WorldCup.team works fine.

@snayrouz
Copy link
Contributor Author

snayrouz commented Jun 2, 2018

@vbrazo thanks for taking a look and making changes! I should have prefaced in my PR that I wasn't ready to merge, just needed some help in regards to all the failing tests. I really appreciate your quick help as I'd love to get this merged before the first matches and see if anyone does anything fun with this library.. I'll probably wait to submit my final PR once the final rosters have been set for all teams June 4.

@snayrouz snayrouz closed this Jun 2, 2018
@vbrazo
Copy link
Member

vbrazo commented Jun 2, 2018

I think the solution would be:

# lib/faker/world_cup.rb
...
      def team
        fetch('world_cup.teams')
      end

      def group(group = 'group_A')
        fetch("world_cup.groups.#{group}")
      end

      def roster(country = 'Egypt', type = 'coach')
        fetch("world_cup.rosters.#{country}.#{type}")
      end
...

otherwise you won't be able to show the nested locales. I think you could finish this PR and just update the locales when the teams are set. It's up to me.

Let me know if you need any help in other PRs or explanations. Just tag me and I'll take a look asap. I'm here to help :)

@snayrouz snayrouz reopened this Jun 2, 2018
@snayrouz
Copy link
Contributor Author

snayrouz commented Jun 2, 2018

@vbrazo that solution makes the tests pass, but with the hard coded group, country and type values, it will only generate those specific values from the library.

also thank you for your help!

@vbrazo
Copy link
Member

vbrazo commented Jun 2, 2018

@snayrouz the hardcoded will only be used when we don't pass the parameters. If you use Faker::WorldCup.roster, you'll be using the default params, but if you pass Faker::WorldCup.roster('Brazil', 'coach'), you should be able to retrieve the Brazilian coach.

It's pretty similar to this module.

@snayrouz
Copy link
Contributor Author

snayrouz commented Jun 2, 2018 via email

@vbrazo
Copy link
Member

vbrazo commented Jun 2, 2018

Feel free to open a new PR to update the locales @snayrouz

@vbrazo vbrazo merged commit e982bc9 into faker-ruby:master Jun 2, 2018
@vbrazo vbrazo self-requested a review July 19, 2018 01:23
davidmorton0 pushed a commit to davidmorton0/faker that referenced this pull request Jul 12, 2021
* Add groups, teams and Egypt roster

* Add group b skeleton with head coaches

* Add group D skeleton and head coaches

* Add group E skeleton and coaches

* Add group F skeleton and coaches

* Add group G skeleton and coaches

* Add group H skeleton and coaches

* Add code comments to showcase prelimanary teams vs final team announcements

* Add Russia roster

* Add saudi arabia roster

* Complete group A rosters

* Create spacing for readability

* Add Iran roster

* Add Morocco roster

* Add Portugal roster

* Complete Group B rosters

* Complete group C rosters

* Complete group D rosters

* Complete group E rosters

* Refactor library

* Add code comment on official roster date

* Add rosters for Panama, England, Belgium, Sweden, South Korea

* Add Tunisia roster

* Add Japan, Poland and Senegal rosters

* Format names on rosters

* Format all names on roster in quotes

* Delete club teams from players

* Setup WorldCup module and tests

* Add tests

* Rebase with master and fix locales to avoid test crashes

* Update changelog

* Fix tests and add documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants