-
-
Notifications
You must be signed in to change notification settings - Fork 756
Move dry_run option higher in ordered option list #3008
Conversation
@tubaxenor May I kindly ask you to describe your use case, why do you need |
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.
I'd reword the explanation slightly and can we get a spec check for this, but otherwise I'm happy with this change.
Co-authored-by: Jon Rowe <[email protected]>
Here is an abstract version of how we use this flag: RSpec.configure do |config|
config.when_first_matching_example_defined(type: :system) do
unless config.dry_run?
require 'graphql/gateway_runner'
Graphql::GatewayRunner.start
end
# Some other stuff runs at very first time a system spec was touched
end
end |
Just pushed a commit to include |
RSpec.configure do |config|
config.when_first_matching_example_defined(:db) do
require "support/db"
end
end
And
a file named "spec/support/db.rb" with:
RSpec.configure do |config|
config.before(:suite) do
puts "Bootstrapped the DB."
end
config.around(:example, :db) do |example|
puts "Starting a DB transaction."
example.run
puts "Rolling back a DB transaction."
end
end While
Would it work for you like this? |
I probably should provide more context about this, we are using kanpsack pro in queue mode to run our specs across CI nodes, which uses dry run at the beginning of every process. And this is why we do lots of
It could work, but the whole point here is to not running extra services (in hooks or not) in dry run, shouldn't a |
Right. That's what I suggest, putting your
Seems explicit. Maybe overly. I admit I may have a bias towards the current state of things with hooks and metadata and against explicit.
Indeed. Wondering if it's the only option like this. In addition to this, there's |
Yes, it does feel wrong to have
After I think? |
Released in 3.13.0, apologies it has taken so long. |
Currently
dry_run
option was set at the end of the options list, which makesRSpec.configuration.dry_run?
always returnfalse
while processing required libs, especiallyspec_helper.rb
.For example in
spec_helper.rb