Switched to jasminrice for coffee specs

openid
Marcin Kulik 12 years ago
parent c61199b4c9
commit 4e5240e24f

@ -19,10 +19,12 @@ group :test, :development do
gem 'factory_girl_rails'
gem 'awesome_print', :require => 'ap'
gem 'jasmine'
gem 'jasmine-headless-webkit'
gem 'jasminerice'
gem 'guard'
gem 'guard-jasmine-headless-webkit'
gem 'guard-jasmine'
gem 'libnotify'
# gem 'jasmine-headless-webkit'
# gem 'guard-jasmine-headless-webkit'
end
group :test do

@ -62,9 +62,12 @@ GEM
guard (1.0.0)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-jasmine-headless-webkit (0.3.2)
guard (>= 0.4.0)
jasmine-headless-webkit (>= 0.7.0)
guard-jasmine (0.9.8)
childprocess
guard (>= 0.8.3)
multi_json
thor
haml (3.1.4)
hike (1.2.1)
i18n (0.6.0)
jasmine (1.1.2)
@ -73,15 +76,11 @@ GEM
rspec (>= 1.3.1)
selenium-webdriver (>= 0.1.3)
jasmine-core (1.1.0)
jasmine-headless-webkit (0.8.4)
coffee-script
jasmine-core (~> 1.1)
multi_json
rainbow
sprockets (~> 2)
jasminerice (0.0.8)
haml
journey (1.0.1)
jquery-rails (2.0.0)
railties (>= 3.2.0.beta, < 5.0)
jquery-rails (1.0.18)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.5)
json_pure (1.6.5)
@ -117,7 +116,6 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rainbow (1.1.3)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
@ -171,9 +169,9 @@ DEPENDENCIES
coffee-rails
factory_girl_rails
guard
guard-jasmine-headless-webkit
guard-jasmine
jasmine
jasmine-headless-webkit
jasminerice
jquery-rails
libnotify
mysql2

@ -1,22 +1,28 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
# Run JS and CoffeeScript files in a typical Rails 3.1 fashion, placing Underscore templates in app/views/*.jst
# Your spec files end with _spec.{js,coffee}.
# # Run JS and CoffeeScript files in a typical Rails 3.1 fashion, placing Underscore templates in app/views/*.jst
# # Your spec files end with _spec.{js,coffee}.
spec_location = "spec/javascripts/%s_spec"
# spec_location = "spec/javascripts/%s_spec"
# uncomment if you use NerdCapsSpec.js
# spec_location = "spec/javascripts/%sSpec"
# # uncomment if you use NerdCapsSpec.js
# # spec_location = "spec/javascripts/%sSpec"
guard 'jasmine-headless-webkit' do
# watch(%r{^app/views/.*\.jst$})
# guard 'jasmine-headless-webkit' do
# # watch(%r{^app/views/.*\.jst$})
watch(%r{^app/assets/javascripts/(.*?)\..*}) do |m|
newest_js_file("spec/javascripts/#{m[1]}_spec")
end
# watch(%r{^app/assets/javascripts/(.*?)\..*}) do |m|
# newest_js_file("spec/javascripts/#{m[1]}_spec")
# end
watch(%r{^spec/javascripts/(.*)_spec\..*}) do |m|
newest_js_file(spec_location % m[1])
end
# watch(%r{^spec/javascripts/(.*)_spec\..*}) do |m|
# newest_js_file(spec_location % m[1])
# end
# end
guard 'jasmine' do
watch(%r{app/assets/javascripts/(.+)\.(js\.coffee|js|coffee)$}) { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
watch(%r{spec/javascripts/(.+)_spec\.(js\.coffee|js|coffee)$}) { |m| puts m.inspect; "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { "spec/javascripts" }
end

@ -30,9 +30,6 @@ class AsciiIo.PlayerView extends Backbone.View
@movie.on 'movie-frame', (frame) =>
@vt.feed(frame)
# changes = @screenBuffer.changes()
# @terminalView.render(changes)
# @screenBuffer.clearChanges()
@movie.on 'movie-finished', =>
@terminalView.stopCursorBlink()

@ -63,5 +63,6 @@ AsciiIo::Application.routes.draw do
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
match "*a", :to => "exceptions#not_found"
# 404 for routing error (prevents engines' routes to work though)
# match "*a", :to => "exceptions#not_found"
end

@ -1,4 +1,4 @@
describe AsciiIo.Brush, ->
describe 'AsciiIo.Brush', ->
describe '.clearCache', ->

@ -1,4 +1,4 @@
describe AsciiIo.HudView, ->
describe 'AsciiIo.HudView', ->
describe 'constructor', ->
it 'creates child elements', ->

@ -1,4 +1,6 @@
describe AsciiIo.Movie, ->
#=require player/movie
describe 'AsciiIo.Movie', ->
movie = data = timing = null
beforeEach ->
@ -54,7 +56,7 @@ describe AsciiIo.Movie, ->
obj.callback.callCount == 1 and obj.callback.argsForCall[0][0] == data
actualDelay = ((new Date).getTime() - nextFrameCallTime) / 1000 # seconds
diff = actualDelay - (timing[0][0] * (1.0 / AsciiIo.Movie::SPEED))
isProperDelay = diff < Math.abs(0.02)
isProperDelay = Math.abs(diff) < 0.05
called and isProperDelay
'movie-frame event not triggered in <delay> time'
1000

@ -1,4 +1,4 @@
describe AsciiIo.PlayerView, ->
describe 'AsciiIo.PlayerView', ->
element = null
cols = 2
lines = 5
@ -87,23 +87,11 @@ describe AsciiIo.PlayerView, ->
it 'feeds interpreter when movie-frame is fired on movie', ->
frame = { some: 'Frame' }
spyOn player.interpreter, 'feed'
spyOn player.vt, 'feed'
player.movie.trigger 'movie-frame', frame
expect(player.interpreter.feed).toHaveBeenCalledWith(frame)
it 'renders and clears buffer changes when movie-frame is fired on movie', ->
frame = { some: 'Frame' }
changes = { someChanges: 'here' }
spyOn player.terminalView, 'render'
spyOn(player.screenBuffer, 'changes').andReturn(changes)
spyOn(player.screenBuffer, 'clearChanges')
player.movie.trigger 'movie-frame', frame
expect(player.terminalView.render).toHaveBeenCalledWith(changes)
expect(player.screenBuffer.clearChanges).toHaveBeenCalled()
expect(player.vt.feed).toHaveBeenCalledWith(frame)
describe '#play', ->
it 'starts movie playback', ->

@ -1,3 +0,0 @@
describe AsciiIo.ScreenBuffer, ->

@ -0,0 +1,3 @@
describe 'AsciiIo.ScreenBuffer', ->

@ -1,4 +1,4 @@
describe AsciiIo.TerminalView, ->
describe 'AsciiIo.TerminalView', ->
describe 'constructor', ->
it 'creates child elements', ->

@ -1,22 +1,33 @@
describe AsciiIo.VT, ->
describe 'AsciiIo.VT', ->
vt = renderer = data = undefined
cols = 80
lines = 24
isSwallowed = (d) ->
# vt = new AsciiIo.VT(cols, lines, renderer)
vt.sb = {} # will throw 'undefined is not a function'
vt.sb = # will throw 'undefined is not a function' for anything else
changes: ->
clearChanges: ->
expect(vt.feed(d || data)).toEqual(true)
beforeEach ->
console.log 'kurwa'
console.log AsciiIo.TerminalView
renderer = new AsciiIo.TerminalView({ cols: cols, lines: lines })
vt = new AsciiIo.VT(cols, lines, renderer)
console.log vt
data = ''
describe '#feed', ->
it 'renders and clears buffer changes', ->
changes = { someChanges: 'here' }
spyOn vt.renderer, 'render'
spyOn(vt.sb, 'changes').andReturn(changes)
spyOn(vt.sb, 'clearChanges')
vt.feed('')
expect(vt.renderer.render).toHaveBeenCalledWith(changes, vt.sb.cursorX,
vt.sb.cursorY)
expect(vt.sb.clearChanges).toHaveBeenCalled()
describe 'C0 set control character', ->
# A single character with an ASCII code within the ranges: 000 to 037 and
# 200 to 237 octal, 00 - 1F and 80 - 9F hex.

@ -0,0 +1,3 @@
/*
*= require application
*/

@ -0,0 +1,2 @@
#= require application
#= require_tree .

@ -1,79 +0,0 @@
# src_files
#
# Return an array of filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# src_files:
# - lib/source1.js
# - lib/source2.js
# - dist/**/*.js
#
src_files:
- application.js
# - "**/*.*"
# stylesheets
#
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# stylesheets:
# - css/style.css
# - stylesheets/*.css
#
# stylesheets:
# - stylesheets/**/*.css
# helpers
#
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
# Default: ["helpers/**/*.js"]
#
# EXAMPLE:
#
# helpers:
# - helpers/**/*.js
#
helpers:
- helpers/**/*
# spec_files
#
# Return an array of filepaths relative to spec_dir to include.
# Default: ["**/*[sS]pec.js"]
#
# EXAMPLE:
#
# spec_files:
# - **/*[sS]pec.js
#
spec_files:
- "**/*[Ss]pec.*"
# src_dir
#
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
# Default: project root
#
# EXAMPLE:
#
# src_dir: public
#
src_dir:
- app/assets/javascripts
- vendor/assets/javascripts
# spec_dir
#
# Spec directory path. Your spec_files must be returned relative to this path.
# Default: spec/javascripts
#
# EXAMPLE:
#
# spec_dir: spec/javascripts
#
spec_dir: spec/javascripts

@ -1,23 +0,0 @@
module Jasmine
class Config
# Add your overrides or custom config code here
end
end
# Note - this is necessary for rspec2, which has removed the backtrace
module Jasmine
class SpecBuilder
def declare_spec(parent, spec)
me = self
example_name = spec["name"]
@spec_ids << spec["id"]
backtrace = @example_locations[parent.description + " " + example_name]
parent.it example_name, {} do
me.report_spec(spec["id"])
end
end
end
end

@ -1,32 +0,0 @@
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
require 'rubygems'
require 'jasmine'
jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
if Jasmine::Dependencies.rspec2?
require 'rspec'
else
require 'spec'
end
jasmine_config = Jasmine::Config.new
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
should_stop = false
if Jasmine::Dependencies.rspec2?
RSpec.configuration.after(:suite) do
spec_builder.stop if should_stop
end
else
Spec::Runner.configure do |config|
config.after(:suite) do
spec_builder.stop if should_stop
end
end
end
spec_builder.start
should_stop = true
spec_builder.declare_suites
Loading…
Cancel
Save