Skip to content

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

Merged
merged 7 commits into from
Dec 28, 2014
Merged

Move preview path default #1236

merged 7 commits into from
Dec 28, 2014

Conversation

cupakromer
Copy link
Member

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.

@@ -0,0 +1,18 @@
RSpec.describe 'RSpec::Rails::Railtie', :skip => 'Requires a fast rails app' do
Copy link
Member

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

@JonRowe
Copy link
Member

JonRowe commented Nov 27, 2014

I assuming this is a WIP?

@cupakromer
Copy link
Member Author

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.

@cupakromer cupakromer force-pushed the move-preview_path-default branch 2 times, most recently from 0bd2209 to 3f8eb3b Compare November 28, 2014 02:41
@cupakromer
Copy link
Member Author

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 rendered output properly has the attribute which is said to be missing.

Appreciate any help debugging that.

@cupakromer cupakromer force-pushed the move-preview_path-default branch from bf4327a to 1c091e1 Compare November 28, 2014 17:16
@cupakromer
Copy link
Member Author

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.

@cupakromer cupakromer force-pushed the move-preview_path-default branch from 1c091e1 to ac02dc3 Compare November 28, 2014 17:25
@cupakromer
Copy link
Member Author

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.

@cupakromer cupakromer force-pushed the move-preview_path-default branch from ac02dc3 to 2d49d01 Compare December 27, 2014 22:27
@cupakromer
Copy link
Member Author

Commit fb6a6c2 resolves #1252

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.
@cupakromer cupakromer force-pushed the move-preview_path-default branch from 2d49d01 to 428872d Compare December 28, 2014 15:54
cupakromer added a commit that referenced this pull request Dec 28, 2014
@cupakromer cupakromer merged commit 49a20ab into master Dec 28, 2014
@cupakromer cupakromer deleted the move-preview_path-default branch December 28, 2014 19:34
mehlah pushed a commit to craftsmen/roll that referenced this pull request Mar 8, 2015
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.`
mehlah pushed a commit to craftsmen/roll that referenced this pull request Mar 8, 2015
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
mehlah pushed a commit to craftsmen/roll that referenced this pull request Mar 10, 2015
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants