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

Faker::Boolean:boolean not working as described in the markdown #2118

Open
NotSorbent opened this issue Sep 13, 2020 · 1 comment
Open

Faker::Boolean:boolean not working as described in the markdown #2118

NotSorbent opened this issue Sep 13, 2020 · 1 comment

Comments

@NotSorbent
Copy link

@NotSorbent NotSorbent commented Sep 13, 2020

Describe the bug

When using Faker::Boolean:boolean in codewars to create a new kata it works without true_ratio being specified, but when specifying true_ratio I needed to use the syntax 'Faker::Boolean:boolean(true_ratio = 0.8)' rather than 'Faker::Boolean:boolean(true_ratio: 0.8)' which is in the boolean.md doc.

To Reproduce

The error when using "true_ratio: 0.8" was:
"Log

An error occurred while loading ./main.rb.
Failure/Error: (rand < true_ratio)

ArgumentError:
comparison of Float with Hash failed

/usr/local/bundle/gems/faker-1.8.4/lib/faker/boolean.rb:5:in `<'

/usr/local/bundle/gems/faker-1.8.4/lib/faker/boolean.rb:5:in `boolean'

./spec.rb:19:in `block in <top (required)>'

./spec.rb:18:in `times'

./spec.rb:18:in `<top (required)>'

./main.rb:2:in `<top (required)>'

No examples found."

It worked with "true_ratio = 0.8"

Expected behavior

The working code should match the boolean.md examples (in this case "true_ratio: 0.8" should not cause an error

Additional context

I am very new to Ruby and new to codewars kata creation so I do not know if this is a feature of the setup or an actual bug.

@sudeeptarlekar
Copy link
Contributor

@sudeeptarlekar sudeeptarlekar commented Sep 14, 2020

If you are using v1.8.4 then right way to call boolean is Faker::Boolean:boolean(0.8), checkout boolean.md for v1.8.4. So, I think this is not a bug.

cc: @koic

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.