Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Commit

Permalink
Compatibility updates for jasmine_core 2.0
Browse files Browse the repository at this point in the history
  - Add boot_file, boot dir hooks for jasmine-core.
  - Remove self-test spec (jasmine-core has its own spec that
  appropriately tests jasmine-core).
  - Remove SpecRunner cruft.
  • Loading branch information
Davis W. Frank & Rajan Agaskar committed Dec 3, 2012
1 parent 2afdf2b commit ac657ce
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 93 deletions.
1 change: 1 addition & 0 deletions Gemfile
@@ -1,6 +1,7 @@
source "http://rubygems.org"
gemspec

gem "jasmine-core", :git => "http://github.com/pivotal/jasmine.git", :branch => '2_0'
unless ENV["TRAVIS"]
group :debug do
gem 'debugger'
Expand Down
54 changes: 0 additions & 54 deletions generators/jasmine/templates/jasmine-example/SpecRunner.html

This file was deleted.

10 changes: 7 additions & 3 deletions lib/jasmine/config.rb
Expand Up @@ -17,7 +17,7 @@ def self.initialize_config
@config.boot_path = boot_path = "/__boot__"

@config.jasmine_dir = core_config.path
@config.boot_dir = core_config.boot_path
@config.boot_dir = core_config.boot_dir
@config.boot_files = lambda { core_config.boot_files }
@config.jasmine_files = lambda { core_config.js_files }
@config.jasmine_css_files = lambda { core_config.css_files }
Expand Down Expand Up @@ -73,11 +73,15 @@ def self.load_configuration_from_yaml(path = nil)
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?
config.jasmine_css_files = lambda { yaml_config.jasmine_css_files } if yaml_config.jasmine_css_files.any?
config.boot_dir = yaml_config.boot_dir if yaml_config.boot_dir
config.boot_files = lambda { yaml_config.boot_files } if yaml_config.boot_files.any?

config.src_dir = yaml_config.src_dir
config.src_files = lambda { yaml_config.src_files }
config.spec_files = lambda { yaml_config.helpers + yaml_config.spec_files }
config.css_files = lambda { yaml_config.css_files }
config.src_dir = yaml_config.src_dir

config.spec_dir = yaml_config.spec_dir
config.spec_files = lambda { yaml_config.helpers + yaml_config.spec_files }
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/jasmine/configuration.rb
Expand Up @@ -26,9 +26,9 @@ def css_files

def js_files
map(@jasmine_files, :jasmine) +
map(@boot_files, :boot) +
map(@src_files, :src) +
map(@spec_files, :spec) +
map(@boot_files, :boot)
map(@spec_files, :spec)
end

def rack_path_map
Expand Down
7 changes: 3 additions & 4 deletions lib/jasmine/core_configuration.rb
Expand Up @@ -8,13 +8,12 @@ def path
@core.path
end

#TODO: maybe this doesn't belong in CoreConfig
def boot_path
Jasmine.root('javascripts')
def boot_dir
@core.boot_dir
end

def boot_files
Dir.glob(File.join(boot_path, "**"))
@core.boot_files
end

def js_files
Expand Down
9 changes: 9 additions & 0 deletions lib/jasmine/yaml_config_parser.rb
Expand Up @@ -22,6 +22,11 @@ def jasmine_dir
File.join(@pwd, loaded_yaml['jasmine_dir'])
end

def boot_dir
return nil unless loaded_yaml['boot_dir']
File.join(@pwd, loaded_yaml['boot_dir'])
end

def src_files
@path_expander.call(src_dir, loaded_yaml['src_files'] || [])
end
Expand All @@ -30,6 +35,10 @@ def jasmine_files
@path_expander.call(jasmine_dir, loaded_yaml['jasmine_files'] || [])
end

def boot_files
@path_expander.call(boot_dir, loaded_yaml['boot_files'] || [])
end

def jasmine_css_files
@path_expander.call(jasmine_dir, loaded_yaml['jasmine_css_files'] || [])
end
Expand Down
2 changes: 1 addition & 1 deletion spec/configuration_spec.rb
Expand Up @@ -73,9 +73,9 @@ def initialize(config)
config.spec_files = lambda { ['spec'] }
config.js_files.should == [
'mapped_jasmine/jasmine/jasmine',
'mapped_boot/boot/boot',
'mapped_src/src/src',
'mapped_spec/spec/spec',
'mapped_boot/boot/boot',
]
end
end
Expand Down
29 changes: 0 additions & 29 deletions spec/jasmine_self_test_spec.rb

This file was deleted.

37 changes: 37 additions & 0 deletions spec/yaml_config_parser_spec.rb
Expand Up @@ -41,6 +41,26 @@
parser.jasmine_dir.should == File.join('some_project_root', 'some_jasmine_dir')
end

it "boot_dir returns nil when boot dir is blank" do
yaml_loader = lambda do |path|
if path == "some_path"
{"boot_dir" => nil}
end
end
parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
parser.boot_dir.should be_nil
end

it "boot_dir returns boot_dir if set" do
yaml_loader = lambda do |path|
if path == "some_path"
{"boot_dir" => 'some_boot_dir'}
end
end
parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
parser.boot_dir.should == File.join('some_project_root', 'some_boot_dir')
end

it "spec_dir uses default path when spec dir is blank" do
yaml_loader = lambda do |path|
if path == "some_path"
Expand Down Expand Up @@ -129,6 +149,23 @@
parser.jasmine_files.should == ['expected_results']
end

it "expands boot_file paths" do
expander = lambda do |dir, patterns|
if (dir == File.join('some_project_root', 'some_boot') && patterns == ['some_patterns'])
['expected_results']
end
end
yaml_loader = lambda do |path|
if path == "some_path"
{ 'boot_dir' => 'some_boot', 'boot_files' => ['some_patterns'] }
end
end

parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)

parser.boot_files.should == ['expected_results']
end

it "expands jasmine css file paths" do
expander = lambda do |dir, patterns|
if (dir == File.join('some_project_root', 'some_jasmine') && patterns == ['some_patterns'])
Expand Down

0 comments on commit ac657ce

Please sign in to comment.