-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change from mocha to rspec-mocks #78
Comments
+1, we already discussed it yesterday on IRC. I think it is just a huge amount of pain to transfer. |
Yeah, its not super high prority and its a bit of a pain. Hopefully theres some sort of automated way of changing... |
By now most module are using rspec-mock or are explicitly configured to use mocha: $ rg mocha modules/voxpupuli/puppet-*/.sync.yml
modules/voxpupuli/puppet-zabbix/.sync.yml
8: mock_with: ":mocha"
modules/voxpupuli/puppet-windowsfeature/.sync.yml
4: mock_with: ":mocha"
modules/voxpupuli/puppet-selinux/.sync.yml
6: mock_with: ':mocha'
modules/voxpupuli/puppet-rabbitmq/.sync.yml
5: mock_with: ":mocha"
modules/voxpupuli/puppet-nodejs/.sync.yml
3: mock_with: ':mocha'
modules/voxpupuli/puppet-firewalld/.sync.yml
3: mock_with: ':mocha'
7: - gem: 'mocha'
modules/voxpupuli/puppet-filemapper/.sync.yml
3: mock_with: ":mocha"
modules/voxpupuli/puppet-erlang/.sync.yml
7: mock_with: ":mocha"
modules/voxpupuli/puppet-corosync/.sync.yml
3: mock_with: ":mocha"
modules/voxpupuli/puppet-cassandra/.sync.yml
3: mock_with: ":mocha" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tl;dr I propose we move Vox Pupuli Puppet modules to use rspec-mocks instead of Mocha. It's not super difficult, and only really affects modules with Ruby specific testing, rather than rspec-puppet. So custom facts, functions or type and provider setups. We can investigate if there is existing tooling to do this automatically, similar to transpec.
Context
In ye olden Ruby days, Mocha was the mocking framework of choice for Ruby testing. There were a lot of things that people liked Mocha for, one of them being stubing of any instance of a class:
Taken from http://stackoverflow.com/questions/1406692/what-are-the-advantages-of-mocha-over-rspecs-built-in-mocking-framework
Since then, rspec-mock has come leaps and bounds, more documented and maintained by the core rspec team. It also has 1:1 feature parity with mocha at this stage it seems.
Mocha has some issues with Ruby 2.3.1 that has caused some travis failures (although it appears to be a bug in Ruby rather than a mocha issue causing these failures, more context: voxpupuli/puppet-nginx#917)
Puppet Engineering is aiming to move completely away from mocha to rspec-mock: https://tickets.puppetlabs.com/browse/MODULES-3958
I propose we move Vox Pupuli Puppet modules to use rspec-mocks instead of Mocha. It's not super difficult, and only really affects modules with Ruby specific testing, rather than rspec-puppet. So custom facts, functions or type and provider setups.
An example of this in action is shown in the nginx module: voxpupuli/puppet-nginx#920
The text was updated successfully, but these errors were encountered: