-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
Default example status to unknown if corrupt #2360
Conversation
Can you add a spec for this? |
@matrinox are you still interested in this? If not I can have a crack at it. |
@xaviershay go ahead :). Thanks! |
No one has done tests for this so I will take a stab at it |
@myronmarston Spec added. Please review |
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.
It's a good start, @matrinox. I left some feedback.
end | ||
expectation.not_to raise_error | ||
end | ||
end |
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.
A few things...
-
Since the failure is in
last_run_statuses
and we already have some specs specifically for that method, I'd prefer this spec was moved to there and re-written to exercise that directly. The specs I'm referring to are here. -
Not raising an error is a good thing, but I think we can make the assertion even stronger; specifically that the status is set to
UNKNOWN_STATUS
. Otherwise, a fix ofexample.fetch(:status, "BWAH HA HA")
could still pass, but the rest of the code in RSpec does not understand that status. So in your re-written spec, please assert that the status is set toUNKNOWN_STATUS
. -
I think in the other spec file you can get by w/o having to write an external fixture like you did here--instead you can just pass hashes to the
simulate_persisted_examples
method w/o a:status
key. That helps keeps everything necessary to understand the spec visible in one place.
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.
-
Thanks for the feedback. I am not super familiar with the rspec library so I just tried my best to put it where it's already kind of testing it.
-
is very good for sure. My main concern was just that it didn't crash but I suppose that it should be unknown, not just nil. That might make me change the code some more
-
Ok thanks! I'll try my best to get that working
Can someone explain to me L107 of spec/rspec/core/configuration/only_failures_support_spec.rb? For context: expect(spec_files_with_failures).to(
be_an(Array) &
be(spec_files_with_failures) &
contain_exactly("./spec_1.rb", "./spec_5.rb")
) Expect x to be x? Is that a typo? |
----------------------------------------------------------- On branch master - Mon 12 Dec 2016 10:49:57 PST by matrinox <geoff.lee@lendesk.com>
----------------------------------------------------------- On branch master - Mon 20 Mar 2017 12:01:23 PDT by matrinox <geofflee25@gmail.com>
I know this isn't related but what's the purpose of 'UNKNOWN_STATUS' beyond defaulting to the old status? If the file itself has an unknown status, then it may not run it despite it potentially being a failure. Especially if it's been corrupted/removed. My proposal is to set unknown statuses as failure (or treat them as such) when loading from file. Thoughts? |
Are you asking what's the purpose of using We use a constant because it guards against typos, and saves a bit of memory by re-using the same string instance. We use this status for examples for which we do not know the status because....what else would se use? If the status is unknown, it makes sense to label it as such. It also allows for filtering from the command line: rspec --tag last_run_status:unknown See #2352 for an example of where this is useful.
I think that's not a good idea because there's no reason to assume examples with an unknown status are failures. For example, maybe the example has never run on this machine before because the repo was just cloned and not all examples ran on the first run (e.g. due to a filter, or due to |
Made changes based on @myronmarston feedback ----------------------------------------------------------- On branch master - Thu 23 Mar 2017 14:46:27 PDT by matrinox <geofflee25@gmail.com>
It's not a typo. We are using that to require memoization. |
It's almost the weekend so I might work on it then but for now, to speed things up a little, do you mind explaining why it's failing only on a jruby configuration? Or how I can easily set it up on my Mac. Thanks |
The bisect cukes randomly fail on JRuby occasionally and we don't know why. Probably a JRuby bug given they pass on MRI 100% of the time. Regardless, I've kicked the JRuby build and we'll see if it goes green. That's how we always deal with it. |
@myronmarston looks good now. Welcome feedback |
Thanks! |
* Default example status to unknown if corrupt ----------------------------------------------------------- On branch master - Mon 12 Dec 2016 10:49:57 PST by matrinox <geoff.lee@lendesk.com> * Add spec for when examples.txt file are corrupted ----------------------------------------------------------- On branch master - Mon 20 Mar 2017 12:01:23 PDT by matrinox <geofflee25@gmail.com> * Default status to UNKNOWN_STATUS if it's valid or nil Made changes based on @myronmarston feedback ----------------------------------------------------------- On branch master - Thu 23 Mar 2017 14:46:27 PDT by matrinox <geofflee25@gmail.com>
* Default example status to unknown if corrupt ----------------------------------------------------------- On branch master - Mon 12 Dec 2016 10:49:57 PST by matrinox <geoff.lee@lendesk.com> * Add spec for when examples.txt file are corrupted ----------------------------------------------------------- On branch master - Mon 20 Mar 2017 12:01:23 PDT by matrinox <geofflee25@gmail.com> * Default status to UNKNOWN_STATUS if it's valid or nil Made changes based on @myronmarston feedback ----------------------------------------------------------- On branch master - Thu 23 Mar 2017 14:46:27 PDT by matrinox <geofflee25@gmail.com>
…#2360) * Default example status to unknown if corrupt ----------------------------------------------------------- On branch master - Mon 12 Dec 2016 10:49:57 PST by matrinox <geoff.lee@lendesk.com> * Add spec for when examples.txt file are corrupted ----------------------------------------------------------- On branch master - Mon 20 Mar 2017 12:01:23 PDT by matrinox <geofflee25@gmail.com> * Default status to UNKNOWN_STATUS if it's valid or nil Made changes based on @myronmarston feedback ----------------------------------------------------------- On branch master - Thu 23 Mar 2017 14:46:27 PDT by matrinox <geofflee25@gmail.com> --- This commit was imported from rspec/rspec-core@6fdff12.
This commit was imported from rspec/rspec-core@82ad6ce.
If the examples.txt is corrupt, it should at least not crash