Created
October 9, 2011 07:42
-
-
Save justinko/1273411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In request/integration/acceptance specs, the more examples you have, the slower the spec. | |
# This obviously applies to any other kind of spec, but the performance trade off | |
# is not worth it for high level tests - it can potentially cost you seconds. | |
# Hard to read/process but fast | |
describe 'viewing a user profile' do | |
before { login } | |
it 'displays the name, birthdate, active, address, phone number, last login' | |
end | |
# Descriptive but much, much slower | |
describe 'viewing a user profile' do | |
before { login } | |
it 'displays the name' | |
it 'displays the birthdate' | |
it 'displays the active status' | |
it 'displays the address' | |
it 'displays the phone number' | |
it 'displays the last login' | |
end | |
# (this is the proposal) | |
# Balanced - descriptive and fast (this would also reflect doc formatting) | |
# Downside: each description is not directly tied to an expectation | |
describe 'viewing a user profile' do | |
before { login } | |
it 'displays the name', | |
'displays the birthdate', | |
'displays the active status', | |
'displays the address', | |
'displays the phone number', | |
'displays the last login' | |
end | |
end | |
# Highest level (too high level IMO) | |
describe 'viewing a user profile' do | |
before { login } | |
it "displays the user's info" | |
end |
@justinko - I've seen a lot of complaints about this issue, though generally related to AR fixtures and/or factory-created models (i.e. create the model instance in before(:all) and have it not roll back until after(:all)). So I believe the pain is widely experienced.
The comma separated descriptions is interesting, but adding it could do odd things to existing suites as multiple args are currently concatenated so you can do things like describe Foo, "#bar" do
. That's legacy, and I'd have no problem breaking that in a 3.0 release, but no sooner.
@dchelimsky - Yeah, the comma separated strings don't really solve anything or offer much to be honest. They need to be tied to an individual expectation or it's just not worth it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@dchelimsky - Comma separated example descriptions would give us complete control of formatting. And plays more nice with editors. Metadata would have to be symbols.
However, do you have this problem that I'm talking about? I would only want to add something to RSpec if others are experiencing this pain.