Permalink
Browse files

Application templates should work with HTTPS too

  • Loading branch information...
1 parent 2d8c104 commit eb27d80383e58d2429e0e0f8a245e211af73345b @mikel mikel committed Nov 27, 2010
@@ -338,7 +338,7 @@ def build(meth, *args)
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)
@@ -221,6 +221,15 @@ def test_template_is_executed_when_supplied
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_usage_read_from_file
File.expects(:read).returns("USAGE FROM FILE")
assert_equal "USAGE FROM FILE", Rails::Generators::AppGenerator.desc

0 comments on commit eb27d80

Please sign in to comment.