-
Notifications
You must be signed in to change notification settings - Fork 96
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
Use verified doubles in specs #260
Conversation
] | ||
@lines = double(smells: @smells) | ||
@lines = instance_double(Reek::Core::Examiner, smells: @smells) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, this test will fail on Reek versions before the Reek::Examiner was renamed to Reek::Core::Examiner, but I'm ok with it for now.
Is missing config in spec_helper config.mock_with :rspec do |mocks|
mocks.syntax = :expect
+ mocks.verify_partial_doubles = true
end |
Hmm, 1.9.2 is failing, no idea why, do we still want to support it? |
It's probably evaling the const before it's defined by the require statement... so, either we can refactor now to use the code from the generator, or just do the release without this then take our time on the refactor |
Since you're doing the work right now, you can decide :) |
395dfc7
to
5ca92f3
Compare
@@ -43,51 +43,63 @@ | |||
MetricFu::Configuration.run {} | |||
allow(File).to receive(:directory?).and_return(true) | |||
@reek = MetricFu::ReekGenerator.new | |||
@examiner = @reek.send(:examiner) | |||
@smell_warning = Reek.const_defined?(:SmellWarning) ? Reek.const_get(:SmellWarning) : Reek.const_get(:Smells).const_get(:SmellWarning) | |||
if @smell_warning.instance_methods.include?(:subclass) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too happy with this kind of hacks in the specs, but I can't think of a better solution right now.
Ruby 1.9.2. is using an older reek version which doesn't implement SmellWarning#smell_type, due to which the verified double fails.
OTOH the older reek output is tested separately.
@bf4, maybe you have a better solution?
@bf4, any ideas for the old reek fix, or just keep it this way for now? |
I suppose this way for now... B mobile phone
|
I just pushed 4.12.0. I couldn't remember my password, so didn't sign it.. will bump a patch if I can remember. |
As noted by @bf4 in #258.