-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Move preview path default #1236
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
Conversation
@@ -0,0 +1,18 @@ | |||
RSpec.describe 'RSpec::Rails::Railtie', :skip => 'Requires a fast rails app' do |
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'm assuming this is a work in progress if it's skipped lol
I assuming this is a WIP? |
It's not a WIP just need to get the build to pass. I'm testing via the example app. I left the skipped task in RSpec as is prefer to test there but it was not easy to get setup. I'm open to ideas, otherwise I can delete it if necessary. |
0bd2209
to
3f8eb3b
Compare
I have no idea why the Rails 4.2.0.beta4 job is failing. I cannot reproduce it locally using what appears to be the same Ruby, Rails, and gem versions. It passes just fine. In the latest build, I added some debug lines and it seems that the Appreciate any help debugging that. |
bf4327a
to
1c091e1
Compare
It doesn't look like the Rails 4-1-stable failures are related to this PR. I have a rough idea where to look and will address it once I figure out the 4.2.0 failures here. |
1c091e1
to
ac02dc3
Compare
Ok looks like the 4.2.0-beta failures may also be unrelated and due to external gems (i.e. neither rspec-rails nor rails) causing the failures. |
ac02dc3
to
2d49d01
Compare
Rails does not seem to provide a clean way to abort something if a generator fails. Under most circumstances this is probably the proper solution. However, for us, these generators calls also function as smoke tests for our actual generator code. If one of them fails, we need to fail the build. Thankfully, if the generator had a problem the status is captured in `$?`. We can verify that the last process was successful and abort when it is not; thus failing the build and notifying the team.
The generator was failing due to the missing require.
This mirrors how Rails sets up the default `preview_path`. Using a `before_initialize` allows the environments to be loaded but shims in before Rails sets up its `test/` default.
This is being tested via the rake task which uses the generated example app. It would be nice to have a lighter weight method of testing the railties in the main RSpec suite, until then keeping this 💀 spec around just clutters the code base.
2d49d01
to
428872d
Compare
Because it's the default configured path since RSpec 3.2.0 (see rspec/rspec-rails#1236), and RSpec warn about it: `WARNING: Action Mailer preview_path is not the RSpec default.`
Because it's the default configured path since RSpec 3.2.0, and RSpec warn about it: `WARNING: Action Mailer preview_path is not the RSpec default.` rspec/rspec-rails#1236
Because it's the default configured path since RSpec 3.2.0, and RSpec warn about it: `WARNING: Action Mailer preview_path is not the RSpec default.` rspec/rspec-rails#1236
This builds on @takashi's work, see #1185, with
ActionMailer
previews. It moves the setting of the default preview path into a Railtie, which mirrors how Rails configures it. This also fixes the broken generator due to a missing require. This was missed previously due to the Rails generators not causing the build to fail if they fail. A shim has been added to the example app generation to catch this in the future.The test for the default preview path is clunky. We do not have a method of creating a lightweight Rails app to use directly from the specs. Instead this adds a custom lightweight script which is shelled out to and run, when the example app runs.