Skip to content

Bring RSpec current with rails 5 beta 3 #1573

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 4 commits into from
Apr 1, 2016
Merged

Conversation

fables-tales
Copy link
Member

Biggest issue here is a regression introduced in the rails controller
testing gem which forces us to do a require of
action_controller/metal/rendering in order to not give a NameError
when booting our test app.

@fables-tales fables-tales force-pushed the rails-further-updates branch from 14db3e6 to 298d6fd Compare March 11, 2016 22:25
@bquorning
Copy link
Contributor

This closes #1571, right?

@bquorning
Copy link
Contributor

Also, I think the require issue just got fixed on Rails master: rails/rails@12cce89

@fables-tales
Copy link
Member Author

@bquorning I worked with @sgrif from rails core on this, so it's likely they've got patches.

@bquorning
Copy link
Contributor

I think, if you rebase on master (after #1571) you’ll have just 1 failing spec.

@fables-tales fables-tales force-pushed the rails-further-updates branch from 298d6fd to d6e9e26 Compare March 20, 2016 11:33
@fables-tales
Copy link
Member Author

@bquorning I've just pushed a rebased version of this. Let's see what happens.

@bquorning
Copy link
Contributor

Yes, there is now one spec example failing:

Failures:
  1) Action Mailer railtie hook in the development environment respects a custom `preview_path`
     Failure/Error:
       expect(
         capture_exec(
           custom_env.merge('CUSTOM_PREVIEW_PATH' => '/custom/path'),
           exec_script
         )
       ).to eq('/custom/path')

       expected: "/custom/path"
            got: #<struct CaptureExec io="/home/travis/build/rspec/bundle/ruby/2.2.0/gems/rb-inotify-0.9.7/lib/rb-inot...d/rspec/rspec-rails/tmp/example_app/spec/support/default_preview_path:9:in `<main>'", exit_status=0>

       (compared using ==)

       Diff:
       @@ -1,2 +1,2 @@
       -"/custom/path"
       +"#<struct CaptureExec io=\"/home/travis/build/rspec/bundle/ruby/2.2.0/gems/rb-inotify-0.9.7/lib/rb-inot...d/rspec/rspec-rails/tmp/example_app/spec/support/default_preview_path:9:in `<main>'\", exit_status=0>"

     # ./spec/verify_mailer_preview_path_spec.rb:62:in `block (3 levels) in <top (required)>'

Running specs locally while bisecting the Rails repository, it seems that rails/rails@de6ad56 is the first offending commit. And sure enough, commenting out config.file_watcher = ActiveSupport::EventedFileUpdateChecker from the generated config/environments/development.rb in our example app makes the spec pass.

Maybe just add one line to our example_app_generator/generate_action_mailer_specs.rb?

comment_lines 'config/environments/development.rb', /file_watcher/

Note: I haven’t investigated why that particular line is making the rspec-rails mailer specs fail.

@bquorning
Copy link
Contributor

…or just add a --skip-listen flag in the generate:app and no_active_record:generate:app generators in the Rakefile – see rails/rails@94dbc48

koenpunt and others added 3 commits April 1, 2016 14:07
This is the same fix as in the mailer template generator
@fables-tales fables-tales force-pushed the rails-further-updates branch from 1f31c72 to e2e196d Compare April 1, 2016 18:08
@fables-tales fables-tales force-pushed the rails-further-updates branch from db0d380 to 0c69f45 Compare April 1, 2016 20:38
@fables-tales
Copy link
Member Author

@rspec/rspec can I get a review on this?

@@ -13,6 +13,8 @@
function_script_file = File.join(rspec_rails_repo_path, 'script/functions.sh')

in_root do
prepend_to_file "Rakefile", "require 'active_support/all'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's totally because rails isn't requiring this properly itself in our sample app, nothing we can really do here :/

@JonRowe JonRowe merged commit ea40c54 into master Apr 1, 2016
@JonRowe JonRowe deleted the rails-further-updates branch April 1, 2016 23:01
@JonRowe
Copy link
Member

JonRowe commented Apr 1, 2016

❤️

@bquorning
Copy link
Contributor

Most of this can/should be reverted once Rails 5.0.0 is out, right?

@fables-tales
Copy link
Member Author

@bquorning we'll assess which parts of it are necessary when the release candidate drops.

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.

4 participants