Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4634

bundle gem: rspec says 'No examples found'

$
0
0

I am in the middle of porting part of a ruby on rails project into a gem. I have used bundle gem to create the new gem directory. For the lib and spec directories, the gem's project layout looks like this:

|- lib|  |- mylib|  |  |- MYCLASS.rb|  |  |- version.rb|  ||  |- mylib.rb||- spec   |- spec_helper.rb   |- mylib      |- test_MYCLASS.rb

The contents of spec/spec_helper.rb:

require "mylib"RSpec.configure do |config|end

The relevant parts of mylib.gemspec, as generated by the bundle gem command:

spec.files         = `git ls-files`.split($/)spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})spec.require_paths = ["lib"]

When I run bundle exec rspec spec, I get

No examples found.Finished in 0.00004 seconds0 examples, 0 failures

Two questions.

  1. Is my directory layout for this gem "correct"? (Assuming there is an official layout)
  2. Why are my tests not running? When I do bundle exec rspec spec/mylib/*, the tests in spec/mylib/test_MYCLASS.rb run, whereas if I do bundle exec rspec spec/mylib/, it says no examples found.

I've looked at similar questions and googled around, but none of them solves my problem.


Viewing all articles
Browse latest Browse all 4634

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>