samvera / browse-everything

Rails engine providing access to files in cloud storage
Apache License 2.0
114 stars 22 forks source link

Instructions for running tests? #218

Open jrochkind opened 6 years ago

jrochkind commented 6 years ago

Are there instructions for how to run tests in development? If not, can some be added to README?

If I try to run bundle exec rspec, I get:

LoadError: cannot load such file -- /Users/jrochkind/code/browse-everything/.internal_test_app/config/environment
  /Users/jrochkind/code/browse-everything/spec/spec_helper.rb:4:in `require'
jrochkind commented 6 years ago

Aha, looks like bundle exec rake works. Recommend adding that to README.

Although I think I still have some failing tests on master doing that, may need additional instructions for additional setup to do?

jrochkind commented 6 years ago

On master fresh check-out, ruby 2.3.3, running bundle exec rake results in 3 failures.

console log ``` $ bundle exec rake Running RuboCop... Inspecting 1 file . 1 file inspected, no offenses detected /Users/jrochkind/.rubies/ruby-2.3.3/bin/ruby -I/Users/jrochkind/.gem/ruby/2.3.3/gems/rspec-core-3.7.1/lib:/Users/jrochkind/.gem/ruby/2.3.3/gems/rspec-support-3.7.1/lib /Users/jrochkind/.gem/ruby/2.3.3/gems/rspec-core-3.7.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb [Coveralls] Set up the SimpleCov formatter. [Coveralls] Using SimpleCov's default settings. ....Capybara starting Puma... * Version 3.11.4 , codename: Love Song * Min threads: 0, max threads: 4 * Listening on tcp://127.0.0.1:63798 ......................................................................................................................................................F.......F..F....................... Failures: 1) BrowseEverything::FileEntry regular file should not be relative parent path Failure/Error: name.match?(/^\.\.?$/) ? true : false NoMethodError: undefined method `match?' for "file.m4v":String Did you mean? match # ./lib/browse_everything/file_entry.rb:18:in `relative_parent_path?' # ./spec/unit/browse_everything/file_entry_spec.rb:16:in `block (3 levels) in ' 2) BrowseEverything::FileEntry directory should not be relative parent path Failure/Error: name.match?(/^\.\.?$/) ? true : false NoMethodError: undefined method `match?' for "th":String Did you mean? match # ./lib/browse_everything/file_entry.rb:18:in `relative_parent_path?' # ./spec/unit/browse_everything/file_entry_spec.rb:35:in `block (3 levels) in ' 3) BrowseEverything::FileEntry parent path should be relative parent path Failure/Error: name.match?(/^\.\.?$/) ? true : false NoMethodError: undefined method `match?' for "..":String Did you mean? match # ./lib/browse_everything/file_entry.rb:18:in `relative_parent_path?' # ./spec/unit/browse_everything/file_entry_spec.rb:49:in `block (3 levels) in ' Finished in 20.06 seconds (files took 9.13 seconds to load) 189 examples, 3 failures Failed examples: rspec ./spec/unit/browse_everything/file_entry_spec.rb:16 # BrowseEverything::FileEntry regular file should not be relative parent path rspec ./spec/unit/browse_everything/file_entry_spec.rb:35 # BrowseEverything::FileEntry directory should not be relative parent path rspec ./spec/unit/browse_everything/file_entry_spec.rb:49 # BrowseEverything::FileEntry parent path should be relative parent path [Coveralls] Outside the CI environment, not sending data. /Users/jrochkind/.rubies/ruby-2.3.3/bin/ruby -I/Users/jrochkind/.gem/ruby/2.3.3/gems/rspec-core-3.7.1/lib:/Users/jrochkind/.gem/ruby/2.3.3/gems/rspec-support-3.7.1/lib /Users/jrochkind/.gem/ruby/2.3.3/gems/rspec-core-3.7.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed ```
jrgriffiniii commented 6 years ago

I can attempt to resolve these for Ruby 2.3.3, but please note that 2.3.7 is the latest in the 2.3.x series and appears to be scheduled to be EOL'd soon:

After this release, we will end the normal maintenance phase of Ruby 2.3, and start the security maintenance phase of it. This means that after the release of 2.3.7 we will never backport any bug fixes to 2.3 except security fixes. The term of the security maintenance phase is scheduled for 1 year. By the end of this term, official support of Ruby 2.3 will be over.

(https://www.ruby-lang.org/en/news/2018/03/28/ruby-2-3-7-released/)

Regardless, the documentation should be updated.

jrochkind commented 6 years ago

I doubt these are unique to 2.3.7. (Although suggest you doc what ruby versions you support too). Let me test in 2.4 to see....

Actually having trouble doing that, I think maybe I need to clean out an engine_cart created app, since I created it in 2.3.3 and now want to switch to 2.4... it complains Your Ruby version is 2.4.3, but your Gemfile specified 2.3.3, I suspect that's about a generated engine-cart app... but I'm having trouble finding it to delete it. So instructions on that would be great too.

Ah, it's an ./internal_test_app, okay, deleting that, testing locally on 2.4.3....

Actually, confirm all tests pass on 2.4.3, so if you only want to support 2.4+, that would be fine (but should be documented). (But our app is still 2.3 and I suspect we're not alone...)

jrgriffiniii commented 6 years ago

Apologies, I'm going to need to rely upon Travis for builds against Ruby/Rails releases (I'm attending a conference and wireless connectivity does not easily permit me to install and test releases). I can still see this through.

jrochkind commented 6 years ago

I don't see any reason it can't wait until after you return from conf. My suspicion was something was failing locally that wouldn't fail on travis, because I was missing some setup, but it may be that was totally wrong.

Confirmed failing tests in master as above on MRI 2.3.7 as well.

I think you either need to add 2.3.7 to travis testing (and get it to pass), or document that you only support 2.4+. But since 2.3.7 is not EOL and I suspect many community apps are still using it, I'd be happier with the former.

I do not know if test failures are from test infrastructure problems, or actual code problems.

Doc updates suggested regardless, as above.