Open
Description
Describe the Bug
I set up a rspec-puppet Vagrant playground to learn and train, with very basic settings, artifacts and tests. Command rspec
runs perfectly if I give it each directory with test specs. But, If I give it a general path like spec/
, or don't specify the path, it runs each test twice.
# I have 4 tests total in classes and defines, plus the coverage test
rspec spec/{classes,defines}
...
5 examples, 0 failures
rspec spec/
...
9 examples, 0 failures
Expected Behavior
The "examples" count at the end should match the exact count of test definitions
Steps to Reproduce
spec/spec_helper.rb
require 'rspec-puppet'
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.parser = 'future'
c.after(:suite) do
RSpec::Puppet::Coverage.report!
end
end
spec/classes/init_spec.rb
require 'spec_helper'
describe 'rspec_test' do
it { is_expected.to compile }
it { is_expected.to create_class('rspec_test')}
end
spec/defines/rspec_test__type_spec.rb
require 'spec_helper'
describe 'rspec_test::type' do
let(:title) { 'title' }
it { is_expected.to compile }
it { is_expected.to create_rspec_test__type('title') }
end
Directory structure
rspec_test $ ls -lAR
.:
total 12
-rw-r--r-- 1 grilo grilo 72 set 10 18:12 Gemfile
drwxr-sr-x 2 grilo grilo 4096 set 10 18:35 manifests
drwxr-sr-x 5 grilo grilo 4096 set 10 18:35 spec
./manifests:
total 8
-rw-r--r-- 1 grilo grilo 69 set 10 18:35 init.pp
-rw-r--r-- 1 grilo grilo 83 set 10 18:35 type.pp
./spec:
total 16
drwxr-sr-x 2 grilo grilo 4096 set 10 18:35 classes
drwxr-sr-x 2 grilo grilo 4096 set 10 18:35 defines
drwxr-sr-x 4 grilo grilo 4096 set 10 18:35 fixtures
-rw-r--r-- 1 grilo grilo 317 set 11 15:10 spec_helper.rb
./spec/classes:
total 4
-rw-r--r-- 1 grilo grilo 136 set 11 14:19 init_spec.rb
./spec/defines:
total 4
-rw-r--r-- 1 grilo grilo 176 set 11 14:19 rspec_test__type_spec.rb
./spec/fixtures:
total 8
drwxr-sr-x 2 grilo grilo 4096 set 10 18:35 manifests
drwxr-sr-x 2 grilo grilo 4096 set 11 15:09 modules
./spec/fixtures/manifests:
total 0
-rw-r--r-- 1 grilo grilo 0 set 10 18:35 site.pp
./spec/fixtures/modules:
total 0
lrwxrwxrwx 1 grilo grilo 9 set 11 15:09 rspec_test -> ../../../
Environment
- Rspec-related gems
- rspec (3.11.0)
- rspec-core (3.11.0)
- rspec-expectations (3.11.0)
- rspec-mocks (3.11.1)
- rspec-puppet (2.12.0)
- rspec-support (3.11.0)
- OS stuff
- Kernel: 4.19.0-21-amd64
- Distro: Linux Mint Debian Edition 4 (Debbie)
- Base: Debian 10.2
- Ruby: 2.5.5p157
- Puppet: 7.18.0
Additional Context
I kinda suspect the module symlink has something to do with it, because it makes spec_helper.rb
appear recursively. But this would be strange, because:
- It would trigger tests indefinitely, not just twice.
- The symlink, if I got it right, is a requirement (at least, I couldn't make it work without it).
I didn't set up Rake because I want to understand bare Rspec-Puppet first.
Thanks,
Emerson