Mange / roadie

Making HTML emails comfortable for the Ruby rockstars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

URI::InvalidComponentError in rspec

henrikldev opened this issue · comments

When I am running my specs I get this error

URI::InvalidComponentError: bad component(expected host component): localhost:3000
/home/henrikas/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/generic.rb:395:in `check_host'
/home/henrikas/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/generic.rb:409:in `host='
/home/henrikas/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/generic.rb:180:in `initialize'
/home/henrikas/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/generic.rb:126:in `new'
/home/henrikas/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/generic.rb:126:in `build'
/home/henrikas/.rvm/gems/ruby-1.9.2-p290@web/gems/roadie-1.1.3/lib/roadie/inliner.rb:186:in `absolute_url_base'

The spec:

it "should render content properly" do
    email = UserMailer.mass_mail(user.email, subject, body).deliver
    email.body.should =~/#{body}/
end

The mailer:

  layout 'user_mailer/layout'
  def mass_mail(to, subject, body)
    @content = body
    @user = User.find_by_email(to)
    mail(
        :to => to,
        :subject => subject
    ) do |format|
      format.html
    end
  end

I am using ruby 1.9.2p290

My gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    abstract (1.0.0)
    actionmailer (3.0.10)
      actionpack (= 3.0.10)
      mail (~> 2.2.19)
    actionpack (3.0.10)
      activemodel (= 3.0.10)
      activesupport (= 3.0.10)
      builder (~> 2.1.2)
      erubis (~> 2.6.6)
      i18n (~> 0.5.0)
      rack (~> 1.2.1)
      rack-mount (~> 0.6.14)
      rack-test (~> 0.5.7)
      tzinfo (~> 0.3.23)
    activemerchant (1.17.0)
      activesupport (>= 2.3.11)
      braintree (>= 2.0.0)
      builder (>= 2.0.0)
      json (>= 1.5.1)
    activemodel (3.0.10)
      activesupport (= 3.0.10)
      builder (~> 2.1.2)
      i18n (~> 0.5.0)
    activerecord (3.0.10)
      activemodel (= 3.0.10)
      activesupport (= 3.0.10)
      arel (~> 2.0.10)
      tzinfo (~> 0.3.23)
    activeresource (3.0.10)
      activemodel (= 3.0.10)
      activesupport (= 3.0.10)
    activesupport (3.0.10)
    acts_as_list (0.1.4)
    addressable (2.2.6)
    arel (2.0.10)
    braintree (2.11.0)
      builder (>= 2.0.0)
    builder (2.1.2)
    cancan (1.6.5)
    chunky_png (1.2.1)
    cocaine (0.2.0)
    coderay (0.9.8)
    compass (0.11.5)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.1)
    css_parser (1.2.6)
      addressable
      rdoc
    daemons (1.1.4)
    delayed_job (2.1.4)
      activesupport (~> 3.0)
      daemons
    diff-lcs (1.1.3)
    erubis (2.6.6)
      abstract (>= 1.0.0)
    factory_girl (2.0.5)
    formtastic (1.2.4)
      actionpack (>= 2.3.7)
      activesupport (>= 2.3.7)
      i18n (~> 0.4)
    fssm (0.2.7)
    growl (1.0.3)
    guard (0.6.2)
      thor (~> 0.14.6)
    guard-rspec (0.4.3)
      guard (>= 0.4.0)
    guard-spork (0.2.1)
      guard (>= 0.2.2)
      spork (>= 0.8.4)
    haml (3.1.2)
    hirb (0.5.0)
    html5-boilerplate (1.0.0)
      compass (>= 0.11.1)
    i18n (0.5.0)
    jquery-rails (1.0.19)
      railties (~> 3.0)
      thor (~> 0.14)
    json (1.5.3)
    mail (2.2.19)
      activesupport (>= 2.3.6)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.6.5)
      ruby_parser (>= 2.0.5)
    mime-types (1.16)
    mysql2 (0.2.11)
    nokogiri (1.5.0)
    paperclip (2.3.16)
      activerecord (>= 2.3.0)
      activesupport (>= 2.3.2)
      cocaine (>= 0.0.2)
      mime-types
    polyglot (0.3.2)
    pry (0.9.5)
      coderay (>= 0.9.8)
      method_source (>= 0.6.5)
      ruby_parser (>= 2.0.5)
      slop (~> 2.1.0)
    rack (1.2.3)
    rack-mount (0.6.14)
      rack (>= 1.0.0)
    rack-test (0.5.7)
      rack (>= 1.0)
    rails (3.0.10)
      actionmailer (= 3.0.10)
      actionpack (= 3.0.10)
      activerecord (= 3.0.10)
      activeresource (= 3.0.10)
      activesupport (= 3.0.10)
      bundler (~> 1.0)
      railties (= 3.0.10)
    rails3-generators (0.17.4)
      railties (>= 3.0.0)
    rails3-jquery-autocomplete (1.0.5)
      rails (~> 3.0)
    railties (3.0.10)
      actionpack (= 3.0.10)
      activesupport (= 3.0.10)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.4)
    rake (0.8.7)
    rb-fsevent (0.4.3.1)
    rdoc (3.9.4)
    remarkable (4.0.0.alpha4)
      rspec (>= 2.0.0.alpha11)
    remarkable_activemodel (4.0.0.alpha4)
      remarkable (~> 4.0.0.alpha4)
      rspec (>= 2.0.0.alpha11)
    remarkable_activerecord (4.0.0.alpha4)
      remarkable (~> 4.0.0.alpha4)
      remarkable_activemodel (~> 4.0.0.alpha4)
      rspec (>= 2.0.0.alpha11)
    roadie (1.1.3)
      actionmailer (~> 3.0)
      css_parser
      nokogiri (>= 1.4.4)
    rspec (2.6.0)
      rspec-core (~> 2.6.0)
      rspec-expectations (~> 2.6.0)
      rspec-mocks (~> 2.6.0)
    rspec-core (2.6.4)
    rspec-expectations (2.6.0)
      diff-lcs (~> 1.1.2)
    rspec-mocks (2.6.0)
    rspec-rails (2.6.1)
      actionpack (~> 3.0)
      activesupport (~> 3.0)
      railties (~> 3.0)
      rspec (~> 2.6.0)
    ruby_parser (2.3.0)
      sexp_processor (~> 3.0)
    sass (3.1.7)
    sexp_processor (3.0.6)
    slop (2.1.0)
    spork (0.8.5)
    thor (0.14.6)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.29)
    will_paginate (3.0.0)

PLATFORMS
  ruby

DEPENDENCIES
  activemerchant
  acts_as_list
  authlogic!
  cancan
  compass
  delayed_job (= 2.1.4)
  exception_notification!
  factory_girl
  flag_shih_tzu!
  formtastic
  growl
  guard
  guard-rspec
  guard-spork
  haml
  hirb
  html5-boilerplate
  i18n
  jquery-rails
  json
  mysql2 (~> 0.2.0)
  paperclip
  pry
  rails (>= 3.0.0)
  rails3-generators
  rails3-jquery-autocomplete
  rake (= 0.8.7)
  rb-fsevent
  remarkable (>= 4.0.0.alpha2)
  remarkable_activemodel (>= 4.0.0.alpha2)
  remarkable_activerecord (>= 4.0.0.alpha2)
  roadie
  rspec (~> 2.5)
  rspec-rails (~> 2.5)
  spork
  webtopay!
  will_paginate (~> 3.0.pre2)

Thanks for the exhaustive report. I changed your report to correctly wrap things in <pre> blocks. Hope you don't mind.

Looks like you set url_options[:host] to localhost:3000 instead of localhost (with 3000 in the :port key). Is this correct?

Yes! That was the problem. Thank you for your quick response