Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

jay thompson's Profile

GitHub User: jaytho

Comments by jay thompson

Avatar

JohnsCurry:

in my case- (i may not be completely pristine with this railscast)

config/initializers/setup_mail.rb
ActionMailer::Base.default_url_options[:host] = "www.productionsite.com"

and

config/environments/production.rb
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.default_url_options = { :host => "www.productionsite.com" }
Avatar

I am humbled by how simple the implementation ended up to add some very complex functionality, simply invoked I think that this is the best episode you have on this site. I await your return, eagerly- don't Why out on us!

Avatar

When I upgraded to Rails 3.2 I had issues with running the seed tasks, only in production. When the seed file ran, it would not find any ActiveRecord models; but would work fine when called from the console.

Turns out, threadsafe was enabled in production, and rake tasks would get tripped up. To fix I had to do:

app/production.rb
   # Enable threaded mode
   config.threadsafe!  unless $rails_rake_task

also a good thing for capistrano recipes.

Avatar
  • in case anyone wants to use VCR for just a piece of a larger test suite, VCR blocks any unapproved HTTP access- and will get in the way of the other tests and they will fail with a warning from VCR (unless hidden behind a rescue block-another story). This was unexpected for me- I want to pick and choose which tests are recorded. I was thinking that the :all option would work, but do not desire to signup for housecleaning on all of the recorded cassettes.

VCR behavior can be modified with the flag set in the config block:

in vcr_config.rb
c.allow_http_connections_when_no_cassette = true

and pass through is allowed for these tests, and what I want.

I hope this helps someone else- this is a great tool thank you so much this cast and this gem.

Avatar

Thanks Myron: Now my vcr_config looks like this from Ryan's:

vcr_config.rb:

vcr_config.rb
require 'vcr'

  VCR.configure do |c|
    c.cassette_library_dir = Rails.root.join("spec", "vcr")
    c.hook_into :webmock
    c.configure_rspec_metadata!
    #was :webmock
    #c.filter_sensitive_data('<WSDL>') { "http://www.webservicex.net:80/uszip.asmx?WSDL" }
  end

  RSpec.configure do |c|
    c.treat_symbols_as_metadata_keys_with_true_values = true
#    c.around(:each, :vcr) do |example|
#      name = example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_")
#      options = example.metadata.slice(:record, :match_requests_on).except(:example_group)
#      VCR.use_cassette(name, options) { example.call }
#    end
  end

and spec_helper.rb has changed the fakeweb include to webmock

spec_helper.rb
require 'webmock/rspec'
Avatar

+1 and thanks for this- (i know this is old, but think this fix is important and deserves a little more amplification)....

this version has the quotation fix for two word menu entries and initializes properly with the trigger "change"

Avatar

I was having troubles with throwing errors with ascii cast example:

@CommentPoller ->
  poll: ->
    setTimeout @request, 5000

turns out that needs to be as in the shownotes:

@CommentPoller =
  poll: ->
    setTimeout @request, 5000

I get undefined errors with the '->'