Conversation
|
LGTM, but out of curiosity, in what scenario would RSpec not be present? |
|
And if RSpec is really not present, why fail silently? If the rake task depends on RSpec, don't we want to let the |
|
RSpec is not present in production; where the bundle is without development, test, etc. We do not want to raise the exception because this rake task is only meant to be available in the development/test environments. It will only work, in fact, if the test group is included. |
|
I guess the other option would be to put this entire task in a big conditional? What do you think the best way to handle this is? |
|
I'm still not quite sure what the problem we're trying to solve is. If someone attempts to run the rake task in production, raising an error seems reasonable to me since it's not meant to be run in production. Is the issue that the rake task somehow is getting invoked automatically when deploying or cooking our servers? |
|
I get it now. Whenever unless Rails.env.production?
namespace :spec do
desc 'Executes user flow specs'
RSpec::Core::RakeTask.new('user_flows') do |t|
t.rspec_opts = %w[--tag user_flow
--order defined
--require ./lib/rspec/formatters/user_flow_formatter.rb
--format UserFlowFormatter]
end
end
end |
|
Pinging @amoose. If you're busy with other things, do you want me to make the change I recommended so we can merge this? |
|
Yes, that would be great Moncef, thanks! |
0a5c32e to
c4cb69c
Compare
**Why**: When the `rake` command is invoked, it parses all rake tasks, even if they're not being called directly. The user_flows rake task requires RSpec, and is not meant to be run in production. By ignoring production, we suppress error messages due to RSpec not being present, which aren't relevant in production. In development, we don't want to rescue the LoadError. We want to make sure the rake task aborts because if RSpec is not present, it's a problem.
c4cb69c to
c3f1c07
Compare
**Why**: When the `rake` command is invoked, it parses all rake tasks, even if they're not being called directly. The user_flows rake task requires RSpec, and is not meant to be run in production. By ignoring production, we suppress error messages due to RSpec not being present, which aren't relevant in production. In development, we don't want to rescue the LoadError. We want to make sure the rake task aborts because if RSpec is not present, it's a problem.
**Why**: When the `rake` command is invoked, it parses all rake tasks, even if they're not being called directly. The user_flows rake task requires RSpec, and is not meant to be run in production. By ignoring production, we suppress error messages due to RSpec not being present, which aren't relevant in production. In development, we don't want to rescue the LoadError. We want to make sure the rake task aborts because if RSpec is not present, it's a problem.
Why
We have a special rake task for running user flow specs, but only when RSpec is present.
How
Removes noisy
putsstatement and fails silently since Rails.logger isn't available.