Add rails generators. Add sources.yaml support. Fix Prototype.js collision on jasmine:ci. Version bump to 0.4.0.
This commit is contained in:
25
generators/jasmine/jasmine_generator.rb
Normal file
25
generators/jasmine/jasmine_generator.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class JasmineGenerator < Rails::Generator::Base
|
||||
def manifest
|
||||
record do |m|
|
||||
|
||||
m.directory "spec/javascripts"
|
||||
m.file "spec/javascripts/SpecHelper.js", "spec/javascripts/SpecHelper.js"
|
||||
m.file "spec/javascripts/ExampleSpec.js", "spec/javascripts/ExampleSpec.js"
|
||||
|
||||
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/sources-rails.yaml", "spec/javascripts/support/sources.yaml"
|
||||
|
||||
m.directory "lib/tasks"
|
||||
m.file "lib/tasks/jasmine.rake", "lib/tasks/jasmine.rake"
|
||||
|
||||
m.readme "INSTALL"
|
||||
end
|
||||
end
|
||||
|
||||
def file_name
|
||||
"create_blog"
|
||||
end
|
||||
|
||||
end
|
||||
9
generators/jasmine/templates/INSTALL
Normal file
9
generators/jasmine/templates/INSTALL
Normal file
@@ -0,0 +1,9 @@
|
||||
Jasmine has been installed with example specs.
|
||||
|
||||
To run the server:
|
||||
|
||||
rake jasmine
|
||||
|
||||
To run the automated CI task with Selenium:
|
||||
|
||||
rake jasmine:ci
|
||||
23
generators/jasmine/templates/lib/tasks/jasmine.rake
Normal file
23
generators/jasmine/templates/lib/tasks/jasmine.rake
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace :jasmine do
|
||||
require 'jasmine'
|
||||
|
||||
desc "Run continuous integration tests"
|
||||
require "spec"
|
||||
require 'spec/rake/spectask'
|
||||
Spec::Rake::SpecTask.new(:ci) do |t|
|
||||
t.spec_opts = ["--color", "--format", "specdoc"]
|
||||
t.verbose = true
|
||||
t.spec_files = ['spec/javascripts/support/jasmine_spec.rb']
|
||||
end
|
||||
task :server do
|
||||
require 'spec/javascripts/support/jasmine_config'
|
||||
|
||||
puts "your tests are here:"
|
||||
puts " http://localhost:8888/run.html"
|
||||
|
||||
Jasmine::Config.new.start_server
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run specs via server"
|
||||
task :jasmine => ['jasmine:server']
|
||||
11
generators/jasmine/templates/spec/javascripts/ExampleSpec.js
Normal file
11
generators/jasmine/templates/spec/javascripts/ExampleSpec.js
Normal file
@@ -0,0 +1,11 @@
|
||||
describe('Example', function () {
|
||||
it('should have a passing test', function() {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
|
||||
describe('nested describe', function () {
|
||||
it('should also have a passing test', function () {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
//You may load required files here, or create test-runner-wide environment settings.
|
||||
@@ -0,0 +1,23 @@
|
||||
require 'jasmine'
|
||||
|
||||
class Jasmine::Config
|
||||
|
||||
def project_root
|
||||
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))
|
||||
end
|
||||
|
||||
# Return an array of files to include before jasmine specs. Override if needed.
|
||||
# def src_files
|
||||
# match_files(src_dir, "**/*.js")
|
||||
# end
|
||||
|
||||
# Path to your JavaScript source files
|
||||
# def src_dir
|
||||
# File.join(project_root, "public")
|
||||
# end
|
||||
|
||||
# Path to your JavaScript specs
|
||||
# def spec_dir
|
||||
# File.join(project_root, 'spec/javascripts')
|
||||
# end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
require 'rubygems'
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config'))
|
||||
|
||||
jasmine_config = Jasmine::Config.new
|
||||
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
|
||||
|
||||
should_stop = false
|
||||
|
||||
Spec::Runner.configure do |config|
|
||||
config.after(:suite) do
|
||||
spec_builder.stop if should_stop
|
||||
end
|
||||
end
|
||||
|
||||
spec_builder.start
|
||||
should_stop = true
|
||||
spec_builder.declare_suites
|
||||
@@ -0,0 +1,8 @@
|
||||
sources:
|
||||
- javascripts/prototype.js
|
||||
- javascripts/effects.js
|
||||
- javascripts/controls.js
|
||||
- javascripts/dragdrop.js
|
||||
- javascripts/application.js
|
||||
src_dir: public
|
||||
spec_dir: spec/javascripts
|
||||
@@ -0,0 +1,5 @@
|
||||
#sources:
|
||||
# - lib/source1.js
|
||||
# - lib/source2.js
|
||||
#src_dir:
|
||||
#spec_dir: spec/javascripts
|
||||
Reference in New Issue
Block a user