Closed amirasaad closed 3 years ago
I don't think @mikker got a chance to cut a copy of the latest gem with the password helpers. Until he gets a chance to do that,
gem 'passwordless', git: "https://github.com/mikker/passwordless.git", branch: "master"
should be in your Gemfile and it will work.
Thanks for the prompt response I will try that
Sorry for disturbing I added the gem as above but got this error, should I also include the helper?
1) User can create a post after login can create post
Failure/Error: passwordless_sign_in @user
NoMethodError:
undefined method `passwordless_sign_in' for #<RSpec::ExampleGroups::UserCanCreateAPostAfterLogin:0x000055934ff2c190>
# ./spec/features/posts_spec.rb:7:in `block (2 levels) in <main>'
https://github.com/mikker/passwordless/blob/master/lib/passwordless/test_helpers.rb#L39-L41 includes it for feature specs if they are tagged tests. Are you using explicit or inferred spec tags?
What happens if you add the following to your rspec config?
config.include ::Passwordless::TestHelpers::SystemTestCase
It works thanks, should it be mentioned in docs?
Nah, I should rather get my act together and get a release out 😊
Thanks for helping out @rickychilcott!
I don't think the gem dependency should be documented, but I wonder about the test helpers only being available in certain spec types
@amirasaad -- Check out https://relishapp.com/rspec/rspec-rails/docs/directory-structure and specifically the config.infer_spec_type_from_file_location!
option.
It's not on by default, I don't think, but it's really helpful to limit dependencies. If you look at https://github.com/mikker/passwordless/blob/master/lib/passwordless/test_helpers.rb, you can see that have different behavior for the same method depending on whether it's a controller test or a feature test. So it kinda depends on what you want.
I could see us adding mention of our reliance on test metadata (and this issue). Mind taking a stab at a doc PR @amirasaad?
I could see us adding mention of our reliance on test metadata (and this issue). Mind taking a stab at a doc PR @amirasaad?
@rickychilcott not at all
Yeah, what wasn't obvious for me that I noticed config.include ::Passwordless::TestHelpers::SystemTestCase
is included as a system in https://github.com/mikker/passwordless/blob/master/lib/passwordless/test_helpers.rb but I had to include it again
Thanks for the clarification
@rickychilcott
Any plans on releasing new version to rubygems? Without this it's hard to use passwordless in integration tests.
Just trying this gem out and hitting this same issue
I got this issue while running rspec
rails_helper.rb: