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 train station generator #2755

Merged
merged 11 commits into from
Jul 2, 2023

Conversation

AngusDSR
Copy link
Contributor

Motivation / Background

Currently, Faker doesn't have a train station generator, and this can be a problem for testing location-based applications or data pipelines that deal with transit data. Having a train station generator would add value to the Faker library and allow for more comprehensive testing of these types of applications.

Additional information

One alternative to adding a new train station generator would be to manually create a list of station names and use them in tests. However, this can be time-consuming and may not provide enough variety in the generated data.

Another alternative would be to use an external library or API to generate train station names, but this would add an additional dependency to the project and may not integrate well with Faker.

Copy link
Contributor

@thdaraujo thdaraujo left a comment

Choose a reason for hiding this comment

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

nice, thanks for working on this! Left a few questions.

lib/faker/travel/train_station.rb Outdated Show resolved Hide resolved
lib/faker/travel/train_station.rb Outdated Show resolved Hide resolved
@AngusDSR
Copy link
Contributor Author

For the Travel > TrainStations faker:

  • added support for optional argument inputs
  • added error handling
  • allowed for case insensitivity
  • extended testing to related to the above points
  • Restructured YAML and code to give precedence to 'region' over 'type'

Copy link
Contributor

@thdaraujo thdaraujo left a comment

Choose a reason for hiding this comment

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

good stuff, thanks for changing the code!

LGTM overall, but I left a few comments. I think we should keep it simple and not downcase the types and regions for now.

doc/travel/train_station.md Outdated Show resolved Hide resolved
lib/faker/travel/train_station.rb Outdated Show resolved Hide resolved
lib/faker/travel/train_station.rb Outdated Show resolved Hide resolved
lib/faker/travel/train_station.rb Show resolved Hide resolved
@AngusDSR
Copy link
Contributor Author

  • removed downcasing and symbol compatibility
  • created #fill_missing_inputs_with_samples method and moved into private with #validate_arguments

Copy link
Contributor

@thdaraujo thdaraujo left a comment

Choose a reason for hiding this comment

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

looks great!

@thdaraujo thdaraujo merged commit a342e3e into faker-ruby:main Jul 2, 2023
7 checks passed
@thdaraujo thdaraujo mentioned this pull request Jul 5, 2023
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