Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove all the File.dirname(__FILE__) code

See "Requiring other files relative to each other" in http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices for more info.
  • Loading branch information...
commit dedfac1b4f2a81ef1de441fd3ca56a251ef62007 1 parent 9f958de
@chrisk chrisk authored
View
4 Rakefile
@@ -1,7 +1,7 @@
require 'rubygems'
require 'rake'
-version = File.read(File.join(File.dirname(__FILE__), "lib", "fake_web", "VERSION")).strip
+version = File.read("lib/fake_web/VERSION").strip
begin
require 'jeweler'
@@ -29,6 +29,7 @@ end
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb", "test/vendor")
+ test.libs << "test"
test.verbose = false
test.warning = true
end
@@ -40,6 +41,7 @@ begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb", "test/vendor")
+ t.libs << "test"
t.rcov_opts << "--sort coverage"
t.rcov_opts << "--exclude gems"
t.warning = true
View
2  lib/fake_web.rb
@@ -13,7 +13,7 @@
module FakeWeb
# Returns the version string for the copy of FakeWeb you have loaded.
- VERSION = File.read(File.join(File.dirname(__FILE__), "fake_web", "VERSION")).strip
+ VERSION = File.read("lib/fake_web/VERSION").strip
# Resets the FakeWeb Registry. This will force all subsequent web requests to
# behave as real requests.
View
2  test/test_allow_net_connect.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestFakeWebAllowNetConnect < Test::Unit::TestCase
View
2  test/test_deprecations.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestDeprecations < Test::Unit::TestCase
View
2  test/test_fake_authentication.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestFakeAuthentication < Test::Unit::TestCase
View
2  test/test_fake_web.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestFakeWeb < Test::Unit::TestCase
View
2  test/test_fake_web_open_uri.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestFakeWebOpenURI < Test::Unit::TestCase
View
2  test/test_helper.rb
@@ -1,5 +1,3 @@
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
-
require 'test/unit'
require 'open-uri'
require 'pathname'
View
2  test/test_missing_open_uri.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestMissingOpenURI < Test::Unit::TestCase
View
2  test/test_missing_pathname.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestMissingPathname < Test::Unit::TestCase
View
2  test/test_other_net_http_libraries.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestOtherNetHttpLibraries < Test::Unit::TestCase
View
2  test/test_precedence.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestPrecedence < Test::Unit::TestCase
View
2  test/test_query_string.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestFakeWebQueryString < Test::Unit::TestCase
View
2  test/test_regexes.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestRegexes < Test::Unit::TestCase
View
2  test/test_response_headers.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestResponseHeaders < Test::Unit::TestCase
View
2  test/test_trailing_slashes.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestFakeWebTrailingSlashes < Test::Unit::TestCase
View
2  test/test_utility.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "test_helper")
+require 'test_helper'
class TestUtility < Test::Unit::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.