Skip to content

Commit

Permalink
move from RAILS_ROOT to Rails.root
Browse files Browse the repository at this point in the history
  • Loading branch information
saturnflyer committed Feb 22, 2013
1 parent c522e95 commit e8c9163
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ In your test_helper.rb/spec_helper.rb:
require 'dataset'
class MiniTest::Unit::TestCase
include Dataset
datasets_directory "#{RAILS_ROOT}/spec/datasets"
datasets_directory "#{Rails.root}/spec/datasets"
end

If you don't use rspec_on_rails, or you have specs that aren't of the RailsExampleGroup type, you should do this in spec_helper.rb:

require 'dataset'
class Spec::Example::ExampleGroup
include Dataset
datasets_directory "#{RAILS_ROOT}/spec/datasets"
datasets_directory "#{Rails.root}/spec/datasets"
end

If you were a user of the Scenarios plugin, and want to do as little as possible to get going (assumes you are using rspec_on_rails):
Expand All @@ -93,7 +93,7 @@ If you were a user of the Scenarios plugin, and want to do as little as possible
@suffix ||= 'Scenario'
end
end
Dataset::Resolver.default = ScenariosResolver.new("#{RAILS_ROOT}/spec/scenarios")
Dataset::Resolver.default = ScenariosResolver.new("#{Rails.root}/spec/scenarios")


== Credits
Expand Down
4 changes: 2 additions & 2 deletions lib/dataset/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
context = Class.new do
extend Dataset::ContextClassMethods
datasets_directory [
"#{RAILS_ROOT}/spec/datasets",
"#{RAILS_ROOT}/test/datasets"
"#{Rails.root}/spec/datasets",
"#{Rails.root}/test/datasets"
].detect {|path| File.directory?(path)}
add_dataset *dataset_names
dataset_session.load_datasets_for self
Expand Down
12 changes: 9 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ def with_sandboxed_options
end

$LOAD_PATH << SPEC_ROOT
RAILS_ROOT = "#{SPEC_ROOT}/.."
$LOAD_PATH << "#{RAILS_ROOT}/lib"
RAILS_LOG_FILE = "#{RAILS_ROOT}/log/test.log"
unless defined?(Rails)
Rails = Module.new do
def self.root
SPEC_ROOT + '/..'
end
end
end
$LOAD_PATH << "#{Rails.root}/lib"
RAILS_LOG_FILE = "#{Rails.root}/log/test.log"
SQLITE_DATABASE = "#{SPEC_ROOT}/sqlite3.db"

require 'fileutils'
Expand Down

0 comments on commit e8c9163

Please sign in to comment.