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 User generator that accepts arguments #1671

Closed
CJAdeszko opened this issue Jul 28, 2019 · 7 comments
Closed

Add User generator that accepts arguments #1671

CJAdeszko opened this issue Jul 28, 2019 · 7 comments

Comments

@CJAdeszko
Copy link

CJAdeszko commented Jul 28, 2019

Type: Feature Request

About: Rather than cobbling together a User object during development using individual Faker methods, it could be nice to have a generic user method that accepts arguments such as name, id, email, username, password and other common user attributes and returns an object with the desired attributes. Or if no arguments are provided, returns a default User object that has username and password attributes (or whatever attributes make sense for a default case).

Example

Instead of having to do:

    name: Faker::Internet.user_name,
    email: Faker::Internet.safe_email,
    password: Faker::Internet.password(6),

Create method that allows:

user = Faker::Internet.user('name', 'email', password')
=> {'name' => 'John Doe', 'email' => 'fake_email@test.com', 'password' => 'pass123' }
@lucasqueiroz
Copy link
Member

Would this return a hash with the info or a data class with attributes for the data? I believe this would be a nice addition to some other classes as well, like Vehicle, where you could generate one with a random or fixed brand, and it returns a vehicle class with the brand, model, year, doors, license plate, etc

ashishra0 added a commit to ashishra0/faker that referenced this issue Sep 6, 2019
  The new user class method will now allow you to do this

  ```
  user = Faker::Internet.user('name', 'email', password')
  => {'name' => 'John Doe', 'email' => 'fake_email@test.com', 'password' => 'pass123' }
  ```
@AmrAdelKhalil
Copy link
Contributor

AmrAdelKhalil commented Sep 14, 2019

Hi, I was passing by and I found this one, I noticed @ashishra0 started working on it but he closed the PR, So is there any problem working on it? I've came up with a solution to this new one, Check it please, I used some of @ashishra0 code for testing my method too, So thanks to him.

@ashishra0
Copy link
Contributor

@AmrAdelKhalil Hey, I had to close that issue because apparently the author had just changed the file structure moments before I came up with a solution. So i had to delete the branch I was working on and pull the fresh changes and start working again.

@ashishra0
Copy link
Contributor

@AmrAdelKhalil The issue is still open, I had created a new PR for it #1730

@AmrAdelKhalil
Copy link
Contributor

AmrAdelKhalil commented Sep 15, 2019

@ashishra0 Hey, This is my bad, I didn't notice the PR, My apologies.

Hey @vbrazo,
it looks like there are two PRs for the same feature as I guess, both #1730 and #1744 are solving the same request, @ashishra0 started it already and made a PR. So, I could close my PR in this case.

@ashishra0
Copy link
Contributor

@AmrAdelKhalil Appreciate it mate! Cheers 👍🏻

ashishra0 added a commit to ashishra0/faker that referenced this issue Sep 19, 2019
  The new user class method will now allow you to do this

  ```
  user = Faker::Internet.user('name', 'email', password')
  => {'name' => 'John Doe', 'email' => 'fake_email@test.com', 'password' => 'pass123' }
  ```
ashishra0 added a commit to ashishra0/faker that referenced this issue Sep 19, 2019
  The new user class method will now allow you to do this

  ```
  user = Faker::Internet.user('name', 'email', password')
  => {'name' => 'John Doe', 'email' => 'fake_email@test.com', 'password' => 'pass123' }
  ```
psibi pushed a commit that referenced this issue Aug 20, 2021
* Add user generator that accepts arguments (#1671)
  The new user class method will now allow you to do this

  ```
  user = Faker::Internet.user('name', 'email', password')
  => {'name' => 'John Doe', 'email' => 'fake_email@test.com', 'password' => 'pass123' }
  ```

* Add user generator that accepts arguments (#1671)
  The new user class method will now allow you to do this

  ```
  user = Faker::Internet.user('name', 'email', password')
  => {'name' => 'John Doe', 'email' => 'fake_email@test.com', 'password' => 'pass123' }
  ```

* add yard docs for user generator

* Add user generator that accepts arguments (#1671)
  The new user class method will now allow you to do this

  ```
  user = Faker::Internet.user('name', 'email', password')
  => {'name' => 'John Doe', 'email' => 'fake_email@test.com', 'password' => 'pass123' }
  ```

* add yard docs for user generator

* reduce hash tags

Co-authored-by: Stephen A. Wilson <stephen-356@hotmail.com>
@thdaraujo
Copy link
Contributor

Hey, folks. In an effort to lighten our load as maintainers and be able to serve you better in the future, the faker-ruby team is working on cleaning out the cobwebs in this repo by pruning the backlog. As there are few of us, there are a lot of items that will simply never earn our attention in a reasonable time frame, and rather than giving you an empty promise, we think it makes more sense to focus on more recent issues. That means, unfortunately, that we must close this issue.

Don't take this the wrong way: our aim is not to diminish the effort people have made or dismiss problems that have been raised. If you feel that we should reopen this issue, then please let us know so that we can reprioritize it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants