Sha256: f3c4a04721b7b0dc7ae678f6c357e56a032058cb4b01c10bc7cf5d22f643fc8a
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
require "test_helper" describe Vanity::Templates do before do not_collecting! end describe "template" do it "resolves templates from the gem by default" do custom_view_path = File.expand_path(File.join(Rails.root, 'app', 'views', 'vanity')) gem_view_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'vanity', 'templates')) expected = File.join(gem_view_path, 'foo.html') assert_equal expected, Vanity::Templates.new.path('foo.html') end it "resolves templates from the Rails view directory if it exists" do begin custom_view_path = File.expand_path(File.join(Rails.root, 'app', 'views', 'vanity')) expected = File.expand_path(File.join(custom_view_path, 'foo.html')) FileUtils.mkpath(custom_view_path) File.open(expected, "w") assert_equal expected, Vanity::Templates.new.path('foo.html') ensure FileUtils.rm_rf(custom_view_path) end end it "ignores an empty view directory" do begin custom_view_path = File.expand_path(File.join(Rails.root, 'app', 'views', 'vanity')) FileUtils.mkpath(custom_view_path) gem_view_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'vanity', 'templates')) expected = File.join(gem_view_path, 'foo.html') assert_equal expected, Vanity::Templates.new.path('foo.html') ensure FileUtils.rm_rf(custom_view_path) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vanity-2.0.0.beta8 | test/templates_test.rb |
vanity-2.0.0.beta7 | test/templates_test.rb |