summaryrefslogtreecommitdiff
path: root/spec/javascripts/backbone
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2017-09-03 19:36:11 -0600
committermo <mo.khan@gmail.com>2017-09-03 19:36:11 -0600
commit11cd3aba0c073a5cf9c65a4aa6acd9082a521246 (patch)
treebd4fae8bbd6e87c5dabbf6538cb04d9ae628c58a /spec/javascripts/backbone
parent168716b78cf4d128d73885f875c4bb6d03caf06b (diff)
change autoview to lookup by path rather than key.
Diffstat (limited to 'spec/javascripts/backbone')
-rw-r--r--spec/javascripts/backbone/models/cake_spec.js.coffee40
-rw-r--r--spec/javascripts/backbone/views/cake_view_spec.js.coffee16
2 files changed, 0 insertions, 56 deletions
diff --git a/spec/javascripts/backbone/models/cake_spec.js.coffee b/spec/javascripts/backbone/models/cake_spec.js.coffee
deleted file mode 100644
index 4223a255..00000000
--- a/spec/javascripts/backbone/models/cake_spec.js.coffee
+++ /dev/null
@@ -1,40 +0,0 @@
-describe "CakeSide.Models.Cake", ->
- subject = (attributes) ->
- new CakeSide.Models.Cake(attributes)
-
- describe "#validate", ->
- it "returns an error when the name is null", ->
- attributes =
- name: null
- 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 = subject(attributes)
- expect(cake.validate(attributes, {})).not.toBe(null)
- expect(cake.isValid()).toBeFalsy()
-
-
- it 'returns an error when the category is blank', ->
- attributes =
- name: 'hi'
- category_id: null
- cake = subject(attributes)
- expect(cake.validate(attributes)).not.toBe(null)
- expect(cake.isValid()).toBeFalsy()
-
- it 'is valid when a name and category is specified', ->
- attributes =
- name: 'hi'
- category_id: 1
- cake = subject(attributes)
- expect(cake.validate(attributes)).toBeUndefined()
- expect(cake.isValid()).toBeTruthy()
-
- describe "#public_url", ->
- it "returns the correct 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
deleted file mode 100644
index f84d70a4..00000000
--- a/spec/javascripts/backbone/views/cake_view_spec.js.coffee
+++ /dev/null
@@ -1,16 +0,0 @@
-describe "CakeSide.Views.My.Cakes.CakeView", ->
- cake = new CakeSide.Models.Cake
- id: '1'
- name: 'chocolate'
- subject = new CakeSide.Views.My.Cakes.CakeView
- model: cake
-
- describe "when there are no photos", ->
- beforeEach ->
- subject.render()
-
- it 'renders the cake', ->
- expect(subject.$el.html()).toMatch(/chocolate/)
-
- it 'does not display any photos', ->
- expect(subject.$el.html()).not.toMatch(/img/)