Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Jasmine.yml should permit ERB blocks

  • Loading branch information...
commit c9daa599b09ac4c4cc9b566b2797a212d5ac26db 1 parent 5c64c26
Davis W. Frank & Rajan Agaskar authored
Showing with 5 additions and 8 deletions.
  1. +5 −1 lib/jasmine/config.rb
  2. +0 −7 spec/yaml_config_parser_spec.rb
View
6 lib/jasmine/config.rb
@@ -1,4 +1,5 @@
module Jasmine
+ require 'erb'
def self.configure(&block)
block.call(self.config)
end
@@ -64,7 +65,10 @@ def self.config
def self.load_configuration_from_yaml(path = nil)
path ||= File.join(Dir.pwd, 'spec', 'javascripts', 'support', 'jasmine.yml')
if File.exist?(path)
- yaml_config = Jasmine::YamlConfigParser.new(path, Dir.pwd, Jasmine::PathExpander.method(:expand), YAML.method(:load_file))
+ yaml_loader = lambda do |filepath|
+ YAML::load(ERB.new(File.read(filepath)).result(binding)) if File.exist?(filepath)
+ end
+ yaml_config = Jasmine::YamlConfigParser.new(path, Dir.pwd, Jasmine::PathExpander.method(:expand), yaml_loader)
Jasmine.configure do |config|
config.jasmine_dir = yaml_config.jasmine_dir if yaml_config.jasmine_dir
config.jasmine_files = lambda { yaml_config.jasmine_files } if yaml_config.jasmine_files.any?
View
7 spec/yaml_config_parser_spec.rb
@@ -179,11 +179,4 @@
parser.helpers.should == []
end
-
- # it "should parse ERB" do
- # @config.stub!(:simple_config_file).and_return(File.expand_path(File.join(@root, 'spec', 'fixture','jasmine.erb.yml')))
- # Dir.stub!(:glob).and_return { |glob_string| [glob_string] }
- # @config.src_files.should == ['file0.js', 'file1.js', 'file2.js',]
- # end
-
end
Please sign in to comment.
Something went wrong with that request. Please try again.