guard-jruby-rspec
guard-jruby-rspec copied to clipboard
guard-jruby-rspec broken for latest guard/guard-rspec 2.2.2
Hi there,
Upgrading guard to latest 2.2.2 breaks guard-jruby-rspec, which fails on 'guard' startup. Error message:
19:23:42 - ERROR - Invalid Guardfile, original error is:
[#] wrong number of arguments calling
initialize(2 for 1) ArgumentError: wrong number of arguments callinginitialize(2 for 1) initialize at /opt/rbenv/versions/jruby-1.7.5/lib/ruby/gems/shared/gems/guard-jruby-rspec-0.2.1/lib/guard/jruby-rspec.rb:42
Root cause is recent change to Guard::RSpec initializer, removing parameters: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec.rb#L11
Cheers
Greg
And the offending line is: https://github.com/jkutner/guard-jruby-rspec/blob/master/lib/guard/jruby-rspec.rb#L42
Cool, can you submit a PR for this? I'll get it in ASAP and cut a release.
OK, I had an initial go at this, but I'm going to step away.
It seems that guard-rspec has also undergone a "compete rewrite", along with the changes in Guard 2.0.
My current level of knowledge of guard-jruby-rspec and these projects is sufficiently low that I'm likely to do more harm than good by attempting a fix right now. I'll leave this to someone with more understanding!
You can see the changes I made so far here: https://github.com/greghuc/guard-jruby-rspec/compare/jkutner:master...master
Here's what I discovered:
Overview of Guard upgrade: https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0
Changes to Guard::Rspec:
Guard::Rspec.run_all method logic has been pushed down into new Guard::RSpec::Runner.run_all method And the Inspector object now lives inside Runner Was: https://github.com/guard/guard-rspec/blob/v3.1.0/lib/guard/rspec.rb#L34 Now: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec.rb#L26 => Either implement Guard::JRubyRSpec::Runner.run_all, or maintain logic in Guard::JRubyRSpec.run_all
Guard::RSpec now uses run_on_modifications, not run_on_changes Was: https://github.com/guard/guard-rspec/blob/v3.1.0/lib/guard/rspec.rb#L48 Now: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec.rb#L34
Not sure if Guard::JRubyRSpec::Formatters::NotificationRSpec is necessary any more. Guard::RSpec::Formatters::Notifier has an identical dump_summary method: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec/formatters/notifier.rb
Hit this problem too. FWIW, the following allows me to work:
gem "guard", "~>1.8.3"
gem "guard-rspec"
gem "guard-jruby-rspec", github: 'jkutner/guard-jruby-rspec'
Hope that helps people use this gem until a better fix is worked out.
+1
This error stil occurs in new version of guard
guard is now locked at revision 2.0+, any other solution to use guard-jruby-rspec??
Having same issue as @vorakumar
Locking the guard-rspec to an old version that still has guard 1.8 as a dependency seems to work as a workaround:
gem "guard", "~>1.8.3"
gem "guard-rspec", "~> 3.0.3"
gem "guard-jruby-rspec", github: 'jkutner/guard-jruby-rspec'
guard-rspec 3.0.3 requires rspec 2. Since we've updated to rspec 3, I think I'll have to address this now. Thank you @greghuc for your initial attempt and for reporting back.
I am implementing this in an rspec3 branch.
Todo:
- [x] Specify upper limits on gem versions we depend on in preparation for a 0.2.2 release, since this code is not compatible with guard-rspec-4.x
- [x] Update specs to use rspec 3 syntax via 2.99
- [x] Implement acceptance specs that will pass when guard is working, both before and after the update
- [x] Update the gemspec to require guard-rspec >= 4.0
- [ ] Use the new guard-rspec API
- [ ] Release guard-rspec 0.2.2 for compatibility with guard-rspec < 4.0 and rspec < 3.0
- [ ] Release guard-rspec 1.0.0 for compatibility with guard-rspec >= 4.0 and rspec >= 3.0
I got about as far in my rspec3 branch as greghuc did earlier when I found an easier way to support RSpec 3, which is my real goal. Updating is not straightforward, and someone still needs to address this. I'm opening #40 to address rspec 3 support.