Application templates should work with HTTPS too

This commit is contained in:
Mikel Lindsaar 2010-11-27 21:40:42 +11:00
parent fd83f9d515
commit 667bcac439
2 changed files with 10 additions and 1 deletions

View File

@ -102,7 +102,7 @@ module Rails
def set_default_accessors!
self.rails_template = case options[:template]
when /^http:\/\//
when /^https:\/\//
options[:template]
when String
File.expand_path(options[:template], Dir.pwd)

View File

@ -113,6 +113,15 @@ module SharedGeneratorTests
assert_match /It works!/, silence(:stdout){ generator.invoke_all }
end
def test_template_is_executed_when_supplied_an_https_path
path = "https://gist.github.com/103208.txt"
template = %{ say "It works!" }
template.instance_eval "def read; self; end" # Make the string respond to read
generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)
assert_match /It works!/, silence(:stdout){ generator.invoke_all }
end
def test_dev_option
generator([destination_root], :dev => true).expects(:run).with("#{@bundle_command} install")
silence(:stdout){ generator.invoke_all }