Rename jasmine.yaml to jasmine.yml.
This commit is contained in:
parent
65622305ae
commit
1b8a4804b7
|
@ -37,9 +37,9 @@ if ARGV[0] == 'init'
|
||||||
rails_tasks_dir = dest_path('lib/tasks')
|
rails_tasks_dir = dest_path('lib/tasks')
|
||||||
if File.exist?(rails_tasks_dir)
|
if File.exist?(rails_tasks_dir)
|
||||||
copy_unless_exists('lib/tasks/jasmine.rake')
|
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
|
else
|
||||||
copy_unless_exists('spec/javascripts/support/jasmine.yaml')
|
copy_unless_exists('spec/javascripts/support/jasmine.yml')
|
||||||
write_mode = 'w'
|
write_mode = 'w'
|
||||||
if File.exist?(dest_path('Rakefile'))
|
if File.exist?(dest_path('Rakefile'))
|
||||||
load dest_path('Rakefile')
|
load dest_path('Rakefile')
|
||||||
|
|
|
@ -9,7 +9,7 @@ class JasmineGenerator < Rails::Generator::Base
|
||||||
m.directory "spec/javascripts/support"
|
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_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_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.directory "lib/tasks"
|
||||||
m.file "lib/tasks/jasmine.rake", "lib/tasks/jasmine.rake"
|
m.file "lib/tasks/jasmine.rake", "lib/tasks/jasmine.rake"
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
src_files:
|
|
||||||
- javascripts/prototype.js
|
|
||||||
- javascripts/effects.js
|
|
||||||
- javascripts/controls.js
|
|
||||||
- javascripts/dragdrop.js
|
|
||||||
- javascripts/application.js
|
|
||||||
spec_files:
|
|
||||||
- **/*.js
|
|
||||||
src_dir: public
|
|
||||||
spec_dir: spec/javascripts
|
|
|
@ -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
|
|
@ -1,10 +0,0 @@
|
||||||
#src_files:
|
|
||||||
# - lib/source1.js
|
|
||||||
# - lib/source2.js
|
|
||||||
# - dist/**/*.js
|
|
||||||
#stylesheets:
|
|
||||||
# - css/style.css
|
|
||||||
#spec_files:
|
|
||||||
# -
|
|
||||||
#src_dir:
|
|
||||||
#spec_dir: spec/javascripts
|
|
|
@ -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
|
|
@ -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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["Rajan Agaskar", "Christian Williams"]
|
s.authors = ["Rajan Agaskar", "Christian Williams"]
|
||||||
s.date = %q{2010-01-26}
|
s.date = %q{2010-01-27}
|
||||||
s.default_executable = %q{jasmine}
|
s.default_executable = %q{jasmine}
|
||||||
s.description = %q{Javascript BDD test framework}
|
s.description = %q{Javascript BDD test framework}
|
||||||
s.email = %q{ragaskar@gmail.com}
|
s.email = %q{ragaskar@gmail.com}
|
||||||
|
@ -23,8 +23,8 @@ Gem::Specification.new do |s|
|
||||||
"generators/jasmine/templates/lib/tasks/jasmine.rake",
|
"generators/jasmine/templates/lib/tasks/jasmine.rake",
|
||||||
"generators/jasmine/templates/spec/javascripts/ExampleSpec.js",
|
"generators/jasmine/templates/spec/javascripts/ExampleSpec.js",
|
||||||
"generators/jasmine/templates/spec/javascripts/SpecHelper.js",
|
"generators/jasmine/templates/spec/javascripts/SpecHelper.js",
|
||||||
"generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yaml",
|
"generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml",
|
||||||
"generators/jasmine/templates/spec/javascripts/support/jasmine.yaml",
|
"generators/jasmine/templates/spec/javascripts/support/jasmine.yml",
|
||||||
"generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb",
|
"generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb",
|
||||||
"generators/jasmine/templates/spec/javascripts/support/jasmine_spec.rb",
|
"generators/jasmine/templates/spec/javascripts/support/jasmine_spec.rb",
|
||||||
"jasmine/contrib/ruby/jasmine_runner.rb",
|
"jasmine/contrib/ruby/jasmine_runner.rb",
|
||||||
|
|
|
@ -4,11 +4,14 @@ describe Jasmine::Config do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@template_dir = File.expand_path(File.join(File.dirname(__FILE__), "../generators/jasmine/templates"))
|
@template_dir = File.expand_path(File.join(File.dirname(__FILE__), "../generators/jasmine/templates"))
|
||||||
@config = Jasmine::Config.new
|
@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
|
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
|
it "if sources.yaml not found" do
|
||||||
File.stub!(:exist?).and_return(false)
|
File.stub!(:exist?).and_return(false)
|
||||||
@config.src_files.should == []
|
@config.src_files.should == []
|
||||||
|
@ -20,7 +23,7 @@ describe Jasmine::Config do
|
||||||
}
|
}
|
||||||
end
|
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'))
|
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yaml'))
|
||||||
YAML.stub!(:load).and_return(false)
|
YAML.stub!(:load).and_return(false)
|
||||||
@config.src_files.should == []
|
@config.src_files.should == []
|
||||||
|
@ -32,8 +35,8 @@ describe Jasmine::Config do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it "using default jasmine.yaml" do
|
it "using default jasmine.yml" 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'))
|
||||||
@config.src_files.should == []
|
@config.src_files.should == []
|
||||||
@config.spec_files.should == ['javascripts/ExampleSpec.js', 'javascripts/SpecHelper.js']
|
@config.spec_files.should == ['javascripts/ExampleSpec.js', 'javascripts/SpecHelper.js']
|
||||||
@config.mappings.should == {
|
@config.mappings.should == {
|
||||||
|
@ -43,7 +46,7 @@ describe Jasmine::Config do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "simple_config stylesheets" do
|
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']})
|
YAML.stub!(:load).and_return({'stylesheets' => ['foo.css', 'bar.css']})
|
||||||
Dir.stub!(:glob).and_return do |glob_string|
|
Dir.stub!(:glob).and_return do |glob_string|
|
||||||
glob_string
|
glob_string
|
||||||
|
@ -60,7 +63,7 @@ describe Jasmine::Config do
|
||||||
original_glob.call(glob_string)
|
original_glob.call(glob_string)
|
||||||
end
|
end
|
||||||
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.spec_files.should == ['javascripts/ExampleSpec.js', 'javascripts/SpecHelper.js']
|
||||||
@config.src_files.should == ['javascripts/prototype.js',
|
@config.src_files.should == ['javascripts/prototype.js',
|
||||||
'javascripts/effects.js',
|
'javascripts/effects.js',
|
||||||
|
@ -77,6 +80,21 @@ describe Jasmine::Config do
|
||||||
'/__spec__/javascripts/SpecHelper.js',
|
'/__spec__/javascripts/SpecHelper.js',
|
||||||
]
|
]
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,11 +105,4 @@ describe Jasmine::Config do
|
||||||
}
|
}
|
||||||
end
|
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
|
end
|
Loading…
Reference in New Issue