Conversation
bronzdoc
approved these changes
Sep 8, 2021
JoshCheek
added a commit
to JoshCheek/dotenv_validator
that referenced
this pull request
Sep 10, 2021
Every spec was failing for me due to `Pathname` not being defined.
IDK why it didn\'t fail for everyone else, but it needs to be explicitly required.
```sh
# Tests pass with this change
$ rake spec
/Users/josh/.rubies/ruby-3.0.2/bin/ruby -I/Users/josh/.gem/ruby/3.0.2/gems/rspec-support-3.10.2/lib:/Users/josh/.gem/ruby/3.0.2/gems/rspec-core-3.10.1/lib /Users/josh/.gem/ruby/3.0.2/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Randomized with seed 61580
.....................
Finished in 0.01305 seconds (files took 0.06699 seconds to load)
21 examples, 0 failures
Randomized with seed 61580
# Stash the change
$ git stash
Saved working directory and index state WIP on explicitly-require-pathname: dbfe346 Merge pull request fastruby#29 from fastruby/fixes/wrong-string-validation
# Now tests fail b/c it can't find `Pathname`
$ rspec --fail-fast
Randomized with seed 49529
F
Failures:
1) DotenvValidator.check when there is a variable that is required and ENV does not have said variable returns false
Failure/Error: root_or_pwd = Pathname.new(ENV["RAILS_ROOT"] || Dir.pwd)
NameError:
uninitialized constant DotenvValidator::Pathname
# ./lib/dotenv_validator.rb:126:in `root'
# ./lib/dotenv_validator.rb:117:in `sample_file'
# ./lib/dotenv_validator.rb:11:in `analyze_variables'
# ./lib/dotenv_validator.rb:51:in `check'
# ./spec/dot_env_validator_spec.rb:34:in `block (5 levels) in <top (required)>'
Finished in 0.00941 seconds (files took 0.09596 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/dot_env_validator_spec.rb:33 # DotenvValidator.check when there is a variable that is required and ENV does not have said variable returns false
Randomized with seed 49529
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28
Description:
There was an error with the code that considered all
format=stringas invalid format. Added a test too.How to test/QA:
You can add the gem using this branch instead of
:mainin a gemfile.I will abide by the code of conduct.