Permalink
Browse files

Add jasminerice and spec

  • Loading branch information...
1 parent 354dbb0 commit 10e5d86a3772fa92609278f89502a29fdd73203d @joshuaclayton committed Oct 4, 2012
Showing with 50 additions and 0 deletions.
  1. +2 −0 Gemfile
  2. +10 −0 Gemfile.lock
  3. +6 −0 Guardfile
  4. +2 −0 Rakefile
  5. +2 −0 lib/tasks/jasmine.rake
  6. +23 −0 spec/javascripts/models/post_spec.coffee
  7. +2 −0 spec/javascripts/spec.coffee
  8. +3 −0 spec/javascripts/spec.scss
View
@@ -22,6 +22,8 @@ group :test, :development do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'faker'
+ gem 'jasminerice'
+ gem 'guard-jasmine'
end
group :test do
View
@@ -77,12 +77,20 @@ GEM
guard (1.3.2)
listen (>= 0.4.2)
thor (>= 0.14.6)
+ guard-jasmine (1.8.3)
+ childprocess
+ guard (>= 1.1.0)
+ multi_json
+ thor
guard-spork (1.1.0)
guard (>= 1.1)
spork (>= 0.8.4)
+ haml (3.1.6)
high_voltage (1.2.0)
hike (1.2.1)
i18n (0.6.1)
+ jasminerice (0.0.8)
+ haml
journey (1.0.4)
jquery-rails (2.1.2)
railties (>= 3.1.0, < 5.0)
@@ -181,8 +189,10 @@ DEPENDENCIES
ejs
factory_girl_rails
faker
+ guard-jasmine
guard-spork
high_voltage
+ jasminerice
jquery-rails
rails (= 3.2.8)
rspec-rails
View
@@ -14,3 +14,9 @@ guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAIL
watch('test/test_helper.rb') { :test_unit }
watch(%r{features/support/}) { :cucumber }
end
+
+guard :jasmine, all_on_start: false, keep_failed: false do
+ watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { 'spec/javascripts' }
+ watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
+ watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) { |m| "spec/javascripts/#{ m[1] }_spec.#{ m[2] }" }
+end
View
@@ -5,3 +5,5 @@
require File.expand_path('../config/application', __FILE__)
BackboneDataBootstrap::Application.load_tasks
+
+task default: ['guard:jasmine', :spec]
@@ -0,0 +1,2 @@
+require 'guard/jasmine/task'
+Guard::JasmineTask.new
@@ -0,0 +1,23 @@
+describe 'App.Models.Post', ->
+ buildPost = (options) ->
+ new App.Models.Post(options)
+
+ describe '#title', ->
+ it 'returns the correct value', ->
+ post = buildPost title: 'Great title'
+ expect(post.title()).toEqual 'Great title'
+
+ describe '#body', ->
+ it 'returns the correct value', ->
+ post = buildPost body: 'Great body'
+ expect(post.body()).toEqual 'Great body'
+
+ describe '#domId', ->
+ it 'returns the correct value', ->
+ post = buildPost dom_id: 'post_1'
+ expect(post.domId()).toEqual 'post_1'
+
+ describe '#authorName', ->
+ it 'returns the correct value', ->
+ post = buildPost author_name: 'John Doe'
+ expect(post.authorName()).toEqual 'John Doe'
@@ -0,0 +1,2 @@
+#=require application
+#=require_tree ./
@@ -0,0 +1,3 @@
+/*
+ *= require application
+ */

0 comments on commit 10e5d86

Please sign in to comment.