summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/backbone/models/cake_spec.js.coffee12
-rw-r--r--spec/javascripts/backbone/views/cake_view_spec.js.coffee8
-rw-r--r--spec/javascripts/spec_helper.coffee13
-rw-r--r--spec/javascripts/spec_helper.js31
4 files changed, 17 insertions, 47 deletions
diff --git a/spec/javascripts/backbone/models/cake_spec.js.coffee b/spec/javascripts/backbone/models/cake_spec.js.coffee
index e69b3f6b..4223a255 100644
--- a/spec/javascripts/backbone/models/cake_spec.js.coffee
+++ b/spec/javascripts/backbone/models/cake_spec.js.coffee
@@ -1,19 +1,19 @@
describe "CakeSide.Models.Cake", ->
- createSUT = (attributes) ->
+ subject = (attributes) ->
new CakeSide.Models.Cake(attributes)
describe "#validate", ->
it "returns an error when the name is null", ->
attributes =
name: null
- cake = createSUT(attributes)
+ cake = subject(attributes)
expect(cake.validate(attributes, {})).not.toBe(null)
expect(cake.isValid()).toBeFalsy()
it "returns an error when the name is blank", ->
attributes =
name: ' '
- cake = createSUT(attributes)
+ cake = subject(attributes)
expect(cake.validate(attributes, {})).not.toBe(null)
expect(cake.isValid()).toBeFalsy()
@@ -22,7 +22,7 @@ describe "CakeSide.Models.Cake", ->
attributes =
name: 'hi'
category_id: null
- cake = createSUT(attributes)
+ cake = subject(attributes)
expect(cake.validate(attributes)).not.toBe(null)
expect(cake.isValid()).toBeFalsy()
@@ -30,11 +30,11 @@ describe "CakeSide.Models.Cake", ->
attributes =
name: 'hi'
category_id: 1
- cake = createSUT(attributes)
+ cake = subject(attributes)
expect(cake.validate(attributes)).toBeUndefined()
expect(cake.isValid()).toBeTruthy()
describe "#public_url", ->
it "returns the correct url", ->
- result = createSUT(slug: '123-cake').public_url()
+ result = subject(slug: '123-cake').public_url()
expect(result).toMatch(/^http:\/\/.+\/creations\/123-cake$/)
diff --git a/spec/javascripts/backbone/views/cake_view_spec.js.coffee b/spec/javascripts/backbone/views/cake_view_spec.js.coffee
index f596ddce..5c61f37f 100644
--- a/spec/javascripts/backbone/views/cake_view_spec.js.coffee
+++ b/spec/javascripts/backbone/views/cake_view_spec.js.coffee
@@ -2,15 +2,15 @@ describe "CakeSide.Views.Cakes.CakeView", ->
cake = new CakeSide.Models.Cake
id: '1'
name: 'chocolate'
- view = new CakeSide.Views.Cakes.CakeView
+ subject = new CakeSide.Views.Cakes.CakeView
model: cake
describe "when there are no photos", ->
beforeEach ->
- view.render()
+ subject.render()
it 'renders the cake', ->
- expect(view.$el.html()).toMatch(/chocolate/)
+ expect(subject.$el.html()).toMatch(/chocolate/)
it 'does not display any photos', ->
- expect(view.$el.html()).not.toMatch(/img/)
+ expect(subject.$el.html()).not.toMatch(/img/)
diff --git a/spec/javascripts/spec_helper.coffee b/spec/javascripts/spec_helper.coffee
index 23866f29..9ff51688 100644
--- a/spec/javascripts/spec_helper.coffee
+++ b/spec/javascripts/spec_helper.coffee
@@ -1,12 +1,17 @@
# Teaspoon includes some support files, but you can use anything from your own support path too.
# require support/jasmine-jquery-1.7.0
# require support/jasmine-jquery-2.0.0
+# require support/jasmine-jquery-2.1.0
# require support/sinon
# require support/your-support-file
#
# PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
# Use this polyfill to avoid the confusion.
-#= require support/bind-poly
+#= require support/phantomjs-shims
+#
+# You can require your own javascript files here. By default this will include everything in application, however you
+# may get better load performance if you require the specific files that are being used in the spec that tests them.
+#= require application
#
# Deferring execution
# If you're using CommonJS, RequireJS or some other asynchronous library you can defer execution. Call
@@ -18,14 +23,10 @@
# Matching files
# By default Teaspoon will look for files that match _spec.{js,js.coffee,.coffee}. Add a filename_spec.js file in your
# spec path and it'll be included in the default suite automatically. If you want to customize suites, check out the
-# configuration in config/initializers/teaspoon.rb
+# configuration in teaspoon_env.rb
#
# Manifest
# If you'd rather require your spec files manually (to control order for instance) you can disable the suite matcher in
# the configuration and use this file as a manifest.
#
# For more information: http://github.com/modeset/teaspoon
-#
-# You can require your own javascript files here. By default this will include everything in application, however you
-# may get better load performance if you require the specific files that are being used in the spec that tests them.
-#= require application
diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js
deleted file mode 100644
index e3a81ec6..00000000
--- a/spec/javascripts/spec_helper.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Teaspoon includes some support files, but you can use anything from your own support path too.
-// require support/jasmine-jquery-1.7.0
-// require support/jasmine-jquery-2.0.0
-// require support/sinon
-// require support/your-support-file
-//
-// PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
-// Use this polyfill to avoid the confusion.
-//= require support/bind-poly
-//
-// Deferring execution
-// If you're using CommonJS, RequireJS or some other asynchronous library you can defer execution. Call
-// Teaspoon.execute() after everything has been loaded. Simple example of a timeout:
-//
-// Teaspoon.defer = true
-// setTimeout(Teaspoon.execute, 1000)
-//
-// Matching files
-// By default Teaspoon will look for files that match _spec.{js,js.coffee,.coffee}. Add a filename_spec.js file in your
-// spec path and it'll be included in the default suite automatically. If you want to customize suites, check out the
-// configuration in config/initializers/teaspoon.rb
-//
-// Manifest
-// If you'd rather require your spec files manually (to control order for instance) you can disable the suite matcher in
-// the configuration and use this file as a manifest.
-//
-// For more information: http://github.com/modeset/teaspoon
-//
-// You can require your own javascript files here. By default this will include everything in application, however you
-// may get better load performance if you require the specific files that are being used in the spec that tests them.
-//= require application