Commit db3c325949e32307ba420f8a6a7f93c17c09a335
1 parent
18329cab
Exists in
master
and in
29 other branches
rails3: Rails.root is not a string anymore
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
test/unit/layout_template_test.rb
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' | @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' | ||
3 | class LayoutTemplateTest < ActiveSupport::TestCase | 3 | class LayoutTemplateTest < ActiveSupport::TestCase |
4 | 4 | ||
5 | should 'read configuration' do | 5 | should 'read configuration' do |
6 | - YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/default/config.yml').returns({'number_of_boxes' => 3, 'description' => 'my description', 'title' => 'my title'}) | 6 | + YAML.expects(:load_file).with(File.join(Rails.root, 'public/designs/templates/default/config.yml')).returns({'number_of_boxes' => 3, 'description' => 'my description', 'title' => 'my title'}) |
7 | t = LayoutTemplate.find('default') | 7 | t = LayoutTemplate.find('default') |
8 | assert_equal 3, t.number_of_boxes | 8 | assert_equal 3, t.number_of_boxes |
9 | assert_equal 'my description', t.description | 9 | assert_equal 'my description', t.description |
@@ -11,9 +11,9 @@ class LayoutTemplateTest < ActiveSupport::TestCase | @@ -11,9 +11,9 @@ class LayoutTemplateTest < ActiveSupport::TestCase | ||
11 | end | 11 | end |
12 | 12 | ||
13 | should 'list all' do | 13 | should 'list all' do |
14 | - Dir.expects(:glob).with(Rails.root + '/public/designs/templates/*').returns([Rails.root + '/public/designs/templates/one', Rails.root + '/public/designs/templates/two']) | ||
15 | - YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/one/config.yml').returns({}) | ||
16 | - YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/two/config.yml').returns({}) | 14 | + Dir.expects(:glob).with(File.join(Rails.root, 'public/designs/templates/*')).returns([File.join(Rails.root, 'public/designs/templates/one'), File.join(Rails.root, 'public/designs/templates/two')]) |
15 | + YAML.expects(:load_file).with(File.join(Rails.root, 'public/designs/templates/one/config.yml')).returns({}) | ||
16 | + YAML.expects(:load_file).with(File.join(Rails.root, 'public/designs/templates/two/config.yml')).returns({}) | ||
17 | 17 | ||
18 | all = LayoutTemplate.all | 18 | all = LayoutTemplate.all |
19 | assert_equivalent [ 'one', 'two' ], all.map(&:id) | 19 | assert_equivalent [ 'one', 'two' ], all.map(&:id) |