guard / guard-cucumber

Guard::Cucumber automatically run your features (much like autotest)
https://rubygems.org/gems/guard-cucumber
MIT License
86 stars 36 forks source link

Cucumber 3.0 compatibility #36

Closed cgriego closed 4 years ago

cgriego commented 7 years ago

It looks like the dump_count method is gone now that there's an actual "summary" formatter, I think replaced by Cucumber::Formatter::ConsoleCounts.

CalvinWalzel commented 7 years ago

I created a possible fix in #37

It's not a very good one, but I'm still learning rails and adding that method helped me make it work again...

todd-a-jacobs commented 5 years ago

I'm unable to find a reference to #dump_count in current Guard or Cucumber sources, although it looks like it may be imported from Cucumber::Formatter::Console. Because I'm not sure where it was being defined, I'm having a hard time grokking what this is really even supposed to do.

The current source is pulling in Cucumber 2.99.0, and when I bumped the constraint to Cucumber 3.1 (01c46fbec0b0e7b3cbde3e88ebf724007cdf80a8) the failing spec becomes spec/guard/cucumber/notification_formatter_spec.rb:18:

  1) Guard::Cucumber::NotificationFormatter after all features formats the notification
     Failure/Error: dump_count(len, "step", status.to_s)

     NoMethodError:
       undefined method `dump_count' for #<Guard::Cucumber::NotificationFormatter:0x00007fc297138ad8>
     # ./lib/guard/cucumber/notification_formatter.rb:150:in `status_to_message'
     # ./lib/guard/cucumber/notification_formatter.rb:116:in `block in notify_summary'
     # ./lib/guard/cucumber/notification_formatter.rb:116:in `map'
     # ./lib/guard/cucumber/notification_formatter.rb:116:in `notify_summary'
     # ./lib/guard/cucumber/notification_formatter.rb:60:in `after_features'
     # ./spec/guard/cucumber/notification_formatter_spec.rb:23:in `block (3 levels) in <top (required)>'

and the RSpec documentation output just says:

Guard::Cucumber::NotificationFormatter
  after all features
    formats the notification (FAILED - 1)

I'd be happy to submit a patch if someone could explain what this bit of code is really trying to accomplish. At first glance, it seems that a minor fix-up like:

def dump_count
  # replicate original method?
  # return nil or empty string, if status_to_message isn't really important?
  # something else?
end

def status_to_message(status)
  len = step_mother.steps(status).length
  dump_count(len, "step", status.to_s)
end

might make this bug go away, but that may be overly simplistic. I'm new to the code base, and hoping someone with more experience with Guard plugins can offer more insight.

Granted that there are probably other ways to run Cucumber from Guard, it seems like this should be fixable. I just need a bit of help understanding how the NotificationFormatter and the missing method are supposed to interact.

rymai commented 4 years ago

FYI v3.0.0 has been released with the fix from #38.

rymai commented 4 years ago

Unfortunately, I don't have owner permission on the gem (yet!). I'll perform the release as soon as I get them.

rymai commented 4 years ago

Ok, the 3.0.0 version has been released now! 🎉