Sha256: 1ceab620658378667dbb719e933d9973cc41ba0d86dc0385b412876235a9df15
Contents?: true
Size: 1.53 KB
Versions: 20
Compression:
Stored size: 1.53 KB
Contents
require "test_helper" describe Vanity::Templates do before do not_collecting! end describe "template" do it "resolves templates from the configured path" 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 a Rails view directory when configured" do begin custom_view_path = File.expand_path(File.join(Rails.root, 'app', 'views', 'vanity')) Vanity.configuration.templates_path = custom_view_path 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
20 entries across 20 versions & 1 rubygems