Skip to content

Commit

Permalink
Rename jasmine.yaml to jasmine.yml.
Browse files Browse the repository at this point in the history
  • Loading branch information
ragaskar committed Jan 28, 2010
1 parent 6562230 commit 1b8a480
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 41 deletions.
4 changes: 2 additions & 2 deletions bin/jasmine
Expand Up @@ -37,9 +37,9 @@ if ARGV[0] == 'init'
rails_tasks_dir = dest_path('lib/tasks')
if File.exist?(rails_tasks_dir)
copy_unless_exists('lib/tasks/jasmine.rake')
copy_unless_exists('spec/javascripts/support/jasmine-rails.yaml', 'spec/javascripts/support/jasmine.yaml')
copy_unless_exists('spec/javascripts/support/jasmine-rails.yml', 'spec/javascripts/support/jasmine.yml')
else
copy_unless_exists('spec/javascripts/support/jasmine.yaml')
copy_unless_exists('spec/javascripts/support/jasmine.yml')
write_mode = 'w'
if File.exist?(dest_path('Rakefile'))
load dest_path('Rakefile')
Expand Down
2 changes: 1 addition & 1 deletion generators/jasmine/jasmine_generator.rb
Expand Up @@ -9,7 +9,7 @@ def manifest
m.directory "spec/javascripts/support"
m.file "spec/javascripts/support/jasmine_config.rb", "spec/javascripts/support/jasmine_config.rb"
m.file "spec/javascripts/support/jasmine_spec.rb", "spec/javascripts/support/jasmine_spec.rb"
m.file "spec/javascripts/support/jasmine-rails.yaml", "spec/javascripts/support/jasmine.yaml"
m.file "spec/javascripts/support/jasmine-rails.yml", "spec/javascripts/support/jasmine.yml"

m.directory "lib/tasks"
m.file "lib/tasks/jasmine.rake", "lib/tasks/jasmine.rake"
Expand Down

This file was deleted.

@@ -0,0 +1,20 @@
# Return an array of filepaths relative to src_dir to include before jasmine specs.
src_files:
- javascripts/prototype.js
- javascripts/effects.js
- javascripts/controls.js
- javascripts/dragdrop.js
- javascripts/application.js

# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
stylesheets:
- stylesheets/**/*.css
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
spec_files:
- **/*.js

# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
src_dir: public

# Spec directory path. Your spec_files must be returned relative to this path.
spec_dir: spec/javascripts
10 changes: 0 additions & 10 deletions generators/jasmine/templates/spec/javascripts/support/jasmine.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions generators/jasmine/templates/spec/javascripts/support/jasmine.yml
@@ -0,0 +1,20 @@
# Return an array of filepaths relative to src_dir to include before jasmine specs.
#src_files:
# - lib/source1.js
# - lib/source2.js
# - dist/**/*.js

# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
#stylesheets:
# - css/style.css
# - stylesheets/*.css

# Return an array of filepaths relative to spec_dir to include before jasmine specs.
#spec_files:
# - **/*.js

# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
#src_dir:

# Spec directory path. Your spec_files must be returned relative to this path.
#spec_dir: spec/javascripts
6 changes: 3 additions & 3 deletions jasmine.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Rajan Agaskar", "Christian Williams"]
s.date = %q{2010-01-26}
s.date = %q{2010-01-27}
s.default_executable = %q{jasmine}
s.description = %q{Javascript BDD test framework}
s.email = %q{ragaskar@gmail.com}
Expand All @@ -23,8 +23,8 @@ Gem::Specification.new do |s|
"generators/jasmine/templates/lib/tasks/jasmine.rake",
"generators/jasmine/templates/spec/javascripts/ExampleSpec.js",
"generators/jasmine/templates/spec/javascripts/SpecHelper.js",
"generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yaml",
"generators/jasmine/templates/spec/javascripts/support/jasmine.yaml",
"generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml",
"generators/jasmine/templates/spec/javascripts/support/jasmine.yml",
"generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb",
"generators/jasmine/templates/spec/javascripts/support/jasmine_spec.rb",
"jasmine/contrib/ruby/jasmine_runner.rb",
Expand Down
41 changes: 26 additions & 15 deletions spec/config_spec.rb
Expand Up @@ -4,11 +4,14 @@
before(:each) do
@template_dir = File.expand_path(File.join(File.dirname(__FILE__), "../generators/jasmine/templates"))
@config = Jasmine::Config.new
@config.stub!(:src_dir).and_return(File.join(@template_dir, "public"))
@config.stub!(:spec_dir).and_return(File.join(@template_dir, "spec"))
end

describe "simple_config" do
describe "configuration" do
before(:each) do
@config.stub!(:src_dir).and_return(File.join(@template_dir, "public"))
@config.stub!(:spec_dir).and_return(File.join(@template_dir, "spec"))
end

it "if sources.yaml not found" do
File.stub!(:exist?).and_return(false)
@config.src_files.should == []
Expand All @@ -20,7 +23,7 @@
}
end

it "if sources.yaml is empty" do
it "if jasmine.yml is empty" do
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yaml'))
YAML.stub!(:load).and_return(false)
@config.src_files.should == []
Expand All @@ -32,8 +35,8 @@
}
end

it "using default jasmine.yaml" do
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yaml'))
it "using default jasmine.yml" do
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
@config.src_files.should == []
@config.spec_files.should == ['javascripts/ExampleSpec.js', 'javascripts/SpecHelper.js']
@config.mappings.should == {
Expand All @@ -43,7 +46,7 @@
end

it "simple_config stylesheets" do
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yaml'))
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
YAML.stub!(:load).and_return({'stylesheets' => ['foo.css', 'bar.css']})
Dir.stub!(:glob).and_return do |glob_string|
glob_string
Expand All @@ -60,7 +63,7 @@
original_glob.call(glob_string)
end
end
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine-rails.yaml'))
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine-rails.yml'))
@config.spec_files.should == ['javascripts/ExampleSpec.js', 'javascripts/SpecHelper.js']
@config.src_files.should == ['javascripts/prototype.js',
'javascripts/effects.js',
Expand All @@ -77,6 +80,21 @@
'/__spec__/javascripts/SpecHelper.js',
]
end

it "should provide a list of all spec files with full paths" do
@config.spec_files_full_paths.should == [
File.join(@template_dir, 'spec/javascripts/ExampleSpec.js'),
File.join(@template_dir, 'spec/javascripts/SpecHelper.js')
]
end

end

it "src_dir uses root when src dir is blank" do
@config.stub!(:project_root).and_return('some_project_root')
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
YAML.stub!(:load).and_return({'src_dir' => nil})
@config.src_dir.should == 'some_project_root'
end


Expand All @@ -87,11 +105,4 @@
}
end

it "should provide a list of all spec files with full paths" do
@config.spec_files_full_paths.should == [
File.join(@template_dir, 'spec/javascripts/ExampleSpec.js'),
File.join(@template_dir, 'spec/javascripts/SpecHelper.js')
]
end

end

0 comments on commit 1b8a480

Please sign in to comment.