Skip to content

Loading…

Update template #501

Closed
wants to merge 2 commits into from

5 participants

@sferik

Two changes to the generated .rspec file.

@dchelimsky
RSpec member

I don't think random order should be the default. @myronmarston, @justinko, any thoughts on that?

@myronmarston
RSpec member

I think that random ordering is an awesome feature that I plan to use on all new projects. It's far easier to prevent order-dependent bugs when you start a project with that turned on than when you go back later and add it--so I like the idea of it being a default.

My one suggestion here is that it is potentially confusing behavior for users that don't know about the randomization feature (and the --seed option), and it's a bit hidden in the .rspec file. Maybe it would be better to put it in the spec_helper.rb file with a comment explaining it? That gives it more visibility.

@dchelimsky
RSpec member

I would be OK with that. @sferik - wanna redo the patch so it does what @myronmarston said?

@sferik

@dchelimsky @myronmarston How does that look?

@myronmarston
RSpec member

Looks great! The comments are really good.

@justinko

I'm pretty sure minitest has random ordering as the default -- people seem to be okay with that.

@dchelimsky
RSpec member

As/is, this breaks cukes which depend on load order, so that's gotta get addressed before this gets merged.

Also, while I'm happy to change colour to color, the rationale statement in the commit message is not only entirely unnecessary, but it welcomes a useless debate about the issue, so I'm not going to include it. Feel free to submit a new pull w/o it, or I'll just cherry pick what I want from the pull.

@sferik

I've reworded the commit message to remove the controversial part.

I think everyone can agree — prima facie — that the American spelling is superior, so a longwinded justification is not necessary. ;)

@dchelimsky
RSpec member

@sferik agreed, thanks. That still leaves the problem that there are some cukes failing intermittently now because the examples within them depend on being run in order (e.g. https://github.com/rspec/rspec-rails/blob/master/features/model_specs/transactional_examples.feature#L58-85). Need to either find all those and specify --order default in each scenario, or implicitly generate a new .rspec file with same in each scenario. I think I prefer the former, as it's explicit, but it's going to be a lot of work.

@alindeman alindeman was assigned
@alindeman

Assigning to myself. I think I may have found all of the places default ordering is required for now.

@alindeman alindeman added a commit that referenced this pull request
@alindeman alindeman Changelog for #501
* Closes #501
0ad477a
@alindeman alindeman added a commit that closed this pull request
@alindeman alindeman Changelog for #501
* Closes #501
0ad477a
@alindeman alindeman closed this in 0ad477a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 7, 2012
  1. @sferik

    Use American-English spelling of color as default

    sferik committed
    This brings the generated `.rspec` file in line with the version used
    in the project: https://github.com/rspec/rspec-rails/blob/master/.rspec
  2. @sferik
View
2 lib/generators/rspec/install/templates/.rspec
@@ -1 +1 @@
---colour
+--color
View
6 lib/generators/rspec/install/templates/spec/spec_helper.rb
@@ -29,4 +29,10 @@
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = "random"
end
Something went wrong with that request. Please try again.