Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Reorder deprecation_summary to come before dump_summary #1365

Merged
merged 2 commits into from
Mar 4, 2014

Conversation

soulcutter
Copy link
Member

deprecation_summary can oftentimes be long and the
last thing printed gets most of the user's focus.
It's probably better that the result of the tests
is given primacy.

deprecation_summary can oftentimes be long and the
last thing printed gets most of the user's focus.
It's probably better that the result of the tests
is given primacy.
@myronmarston
Copy link
Member

LGTM.

@myronmarston
Copy link
Member

Actually, should there be a test that shows that dump_summary comes after deprecation_summary?

@soulcutter
Copy link
Member Author

It is possible to test, but I'm not sure such a test has a lot of value.

What might be useful to capture in a spec is the behavior that the dump_summary shows up in the last 3 lines or something, right? I wouldn't necessarily want to just test the implementation on this one.

@myronmarston
Copy link
Member

It is possible to test, but I'm not sure such a test has a lot of value.

I think something like this would have value:

it "dumps the failure summary after the deprecation summary so failures don't scroll off the screen and get missed" do
  formatter = instance_double("RSpec::Core::Formatter::ProgressFormatter")
  reporter.register_listener(formatter, :dump_summary, :deprecation_summary)

  expect(formatter).to receive(:deprecation_summary).ordered
  expect(formatter).to receive(:dump_summary).ordered

  reporter.finish
end

It'll prevent future regressions and, importantly, shows intent: if we ever try changing the order of these, we'll get a failure that tells us exactly why this order was chosen, at which point we can decide if that reason is still valid.

What might be useful to capture in a spec is the behavior that the dump_summary shows up in the last 3 lines or something, right? I wouldn't necessarily want to just test the implementation on this one.

That could work, but sounds more difficult. You'd have to ensure the deprecation summary output was more than 3 lines for it to really demonstrate this, and the 3 line threshold seems kinda arbitrary/brittle.

@JonRowe
Copy link
Member

JonRowe commented Mar 3, 2014

I'd add the spec @myronmarston suggests

@soulcutter
Copy link
Member Author

That's fair. I know the one I was thinking would have been harder to write, but I figured that was how to capture the intent. The description string of the example works, I suppose

@soulcutter
Copy link
Member Author

Thanks for the spec, @myronmarston - all I had to do was find a context for it

@myronmarston
Copy link
Member

The description string of the example works, I suppose

This is one of the reasons I like writing doc strings rather than using one-liners or rspec-given. I use it to express intent all over the place :).

LGTM, merge when green.

soulcutter added a commit that referenced this pull request Mar 4, 2014
Reorder deprecation_summary to come before dump_summary
@soulcutter soulcutter merged commit 2a25e25 into master Mar 4, 2014
@soulcutter soulcutter deleted the reorder-deprecation-summary branch March 4, 2014 00:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants