Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rails generator installs examples from Jasmine.

  • Loading branch information...
commit 920e918e2655be80dbcf7b7af875f6025dbcff17 1 parent 43dfa00
Lee Byrd & Christian Williams authored
View
12 Rakefile
@@ -23,13 +23,16 @@ end
desc "Run specs via server"
task :jasmine => ['jasmine:server']
-
namespace :jeweler do
unless File.exists?('jasmine/lib')
raise "Jasmine submodule isn't present. Run git submodule update --init"
end
+ # copy jasmine's example tree into our generator templates dir
+ FileUtils.rm_r('generators/jasmine/templates/jasmine-example')
+ FileUtils.cp_r('jasmine/example', 'generators/jasmine/templates/jasmine-example')
+
begin
require "jeweler"
Jeweler::Tasks.new do |gemspec|
@@ -43,11 +46,12 @@ namespace :jeweler do
gemspec.files = FileList.new(
'generators/**/**',
'lib/**/**',
- 'jasmine/lib/consolex.js',
'jasmine/lib/jasmine.css',
'jasmine/lib/jasmine.js',
- 'jasmine/lib/json2.js',
- 'jasmine/lib/TrivialReporter.js',
+ 'jasmine/lib/jasmine-html.js',
+ 'jasmine/lib/consolex.js', # try to get rid of this
+ 'jasmine/lib/json2.js', # try to get rid of this
+ 'jasmine/example/**',
'tasks/**',
'templates/**'
)
View
8 generators/jasmine/jasmine_generator.rb
@@ -2,11 +2,15 @@ class JasmineGenerator < Rails::Generator::Base
def manifest
record do |m|
+ m.directory "public/javascripts"
+ m.file "jasmine-example/src/Player.js", "public/javascripts/Player.js"
+ m.file "jasmine-example/src/Song.js", "public/javascripts/Song.js"
+
m.directory "spec/javascripts"
- m.file "spec/javascripts/ExampleSpec.js", "spec/javascripts/ExampleSpec.js"
+ m.file "jasmine-example/spec/PlayerSpec.js", "spec/javascripts/PlayerSpec.js"
m.directory "spec/javascripts/helpers"
- m.file "spec/javascripts/helpers/SpecHelper.js", "spec/javascripts/helpers/SpecHelper.js"
+ m.file "jasmine-example/spec/SpecHelper.js", "spec/javascripts/helpers/SpecHelper.js"
m.directory "spec/javascripts/support"
m.file "spec/javascripts/support/jasmine_runner.rb", "spec/javascripts/support/jasmine_runner.rb"
View
11 generators/jasmine/templates/spec/javascripts/ExampleSpec.js
@@ -1,11 +0,0 @@
-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);
- });
- });
-});
View
1  generators/jasmine/templates/spec/javascripts/helpers/SpecHelper.js
@@ -1 +0,0 @@
-//You may load required files here, or create test-runner-wide environment settings.
View
1  generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml
@@ -16,6 +16,7 @@ src_files:
- public/javascripts/controls.js
- public/javascripts/dragdrop.js
- public/javascripts/application.js
+ - public/javascripts/**/*.js
# stylesheets
#
2  jasmine
@@ -1 +1 @@
-Subproject commit 22065fafad31698909e72dcecdb085e531a49e8f
+Subproject commit ed80a0cad7ebd593d722aa920ce70c91a846fc33
View
12 jasmine.gemspec
@@ -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-06-23}
+ s.date = %q{2010-06-25}
s.default_executable = %q{jasmine}
s.description = %q{Javascript BDD test framework}
s.email = %q{ragaskar@gmail.com}
@@ -20,14 +20,18 @@ Gem::Specification.new do |s|
s.files = [
"generators/jasmine/jasmine_generator.rb",
"generators/jasmine/templates/INSTALL",
+ "generators/jasmine/templates/jasmine-example/SpecRunner.html",
+ "generators/jasmine/templates/jasmine-example/spec/PlayerSpec.js",
+ "generators/jasmine/templates/jasmine-example/spec/SpecHelper.js",
+ "generators/jasmine/templates/jasmine-example/src/Player.js",
+ "generators/jasmine/templates/jasmine-example/src/Song.js",
"generators/jasmine/templates/lib/tasks/jasmine.rake",
- "generators/jasmine/templates/spec/javascripts/ExampleSpec.js",
- "generators/jasmine/templates/spec/javascripts/helpers/SpecHelper.js",
"generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml",
"generators/jasmine/templates/spec/javascripts/support/jasmine.yml",
"generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb",
- "jasmine/lib/TrivialReporter.js",
+ "jasmine/example/SpecRunner.html",
"jasmine/lib/consolex.js",
+ "jasmine/lib/jasmine-html.js",
"jasmine/lib/jasmine.css",
"jasmine/lib/jasmine.js",
"jasmine/lib/json2.js",
View
4 lib/jasmine/server.rb
@@ -29,8 +29,8 @@ class RunAdapter
def initialize(config)
@config = config
@jasmine_files = [
- "/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first),
- "/__JASMINE_ROOT__/lib/TrivialReporter.js",
+ "/__JASMINE_ROOT__/lib/jasmine.js",
+ "/__JASMINE_ROOT__/lib/jasmine-html.js",
"/__JASMINE_ROOT__/lib/json2.js",
"/__JASMINE_ROOT__/lib/consolex.js",
]
View
18 spec/config_spec.rb
@@ -36,17 +36,17 @@
it "should return the correct files and mappings" do
@config.src_files.should == []
@config.stylesheets.should == []
- @config.spec_files.should == ['ExampleSpec.js']
+ @config.spec_files.should == ['PlayerSpec.js']
@config.helpers.should == ['helpers/SpecHelper.js']
@config.js_files.should == [
'/__spec__/helpers/SpecHelper.js',
- '/__spec__/ExampleSpec.js',
+ '/__spec__/PlayerSpec.js',
]
- @config.js_files("ExampleSpec.js").should ==
+ @config.js_files("PlayerSpec.js").should ==
['/__spec__/helpers/SpecHelper.js',
- '/__spec__/ExampleSpec.js']
+ '/__spec__/PlayerSpec.js']
@config.spec_files_full_paths.should == [
- File.join(@template_dir, 'spec/javascripts/ExampleSpec.js'),
+ File.join(@template_dir, 'spec/javascripts/PlayerSpec.js'),
]
end
end
@@ -150,7 +150,7 @@
end
end
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine-rails.yml'))
- @config.spec_files.should == ['ExampleSpec.js']
+ @config.spec_files.should == ['PlayerSpec.js']
@config.helpers.should == ['helpers/SpecHelper.js']
@config.src_files.should == ['public/javascripts/prototype.js',
'public/javascripts/effects.js',
@@ -164,16 +164,16 @@
'/public/javascripts/dragdrop.js',
'/public/javascripts/application.js',
'/__spec__/helpers/SpecHelper.js',
- '/__spec__/ExampleSpec.js',
+ '/__spec__/PlayerSpec.js',
]
- @config.js_files("ExampleSpec.js").should == [
+ @config.js_files("PlayerSpec.js").should == [
'/public/javascripts/prototype.js',
'/public/javascripts/effects.js',
'/public/javascripts/controls.js',
'/public/javascripts/dragdrop.js',
'/public/javascripts/application.js',
'/__spec__/helpers/SpecHelper.js',
- '/__spec__/ExampleSpec.js'
+ '/__spec__/PlayerSpec.js'
]
end
Please sign in to comment.
Something went wrong with that request. Please try again.