Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1424

Ruby specs fail when run with rake

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.8
    • 0.8
    • Ruby - Library
    • None
    • Patch Available

    Description

      If I run rake in the rb directory the specs fail to load the spec_helper:

      spec/serializer_spec.rb:23:in `require': no such file to load -- spec/spec_helper (LoadError)
              from spec/serializer_spec.rb:23:in `<top (required)>'
              from /home/psanford/.rvm/gems/ruby-1.9.2-p180@thrift/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:15:in `load'
              from /home/psanford/.rvm/gems/ruby-1.9.2-p180@thrift/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:15:in `block in load_files'
              from /home/psanford/.rvm/gems/ruby-1.9.2-p180@thrift/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:14:in `each'
              from /home/psanford/.rvm/gems/ruby-1.9.2-p180@thrift/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:14:in `load_files'
              from /home/psanford/.rvm/gems/ruby-1.9.2-p180@thrift/gems/rspec-1.3.2/lib/spec/runner/options.rb:134:in `run_examples'
              from /home/psanford/.rvm/gems/ruby-1.9.2-p180@thrift/gems/rspec-1.3.2/lib/spec/runner/command_line.rb:9:in `run'
              from /home/psanford/.rvm/gems/ruby-1.9.2-p180@thrift/gems/rspec-1.3.2/bin/spec:5:in `<main>'
      rake aborted!
      

      If I cd into the spec dir and run 'spec *spec.rb' everything works.

      The problem is all the spec files require the spec_helper via:

      require File.dirname(__FILE__) + '/spec_helper'
      

      This will expand the dirname relative to where ruby was invoked. Changing this to:

      require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
      

      will fix this issue.

      Attachments

        Activity

          People

            psanford Peter Sanford
            psanford Peter Sanford
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: