chai-backbone-rails 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md
CHANGED
@@ -2,6 +2,7 @@ Backbone::Chai
|
|
2
2
|
==============
|
3
3
|
|
4
4
|
- Adds Chai matchers for common backbone assertions
|
5
|
+
- Adds Chai matchers to assert changes
|
5
6
|
- Adds Chai matchers for common sinon assertions
|
6
7
|
- Adds support for Factories
|
7
8
|
|
@@ -116,7 +117,7 @@ There are 2 helper methods to help check if traits are set:
|
|
116
117
|
|
117
118
|
and
|
118
119
|
|
119
|
-
this.
|
120
|
+
this.is('admin') # returns a boolean value
|
120
121
|
|
121
122
|
Extended example:
|
122
123
|
|
@@ -124,7 +125,7 @@ Extended example:
|
|
124
125
|
attributes.gender = @trait('male', 'female') || 'male'
|
125
126
|
|
126
127
|
returningClass = User
|
127
|
-
if @
|
128
|
+
if @is('admin')
|
128
129
|
returningClass = AdminUser
|
129
130
|
|
130
131
|
new returningClass attributes
|
@@ -45,11 +45,11 @@ describe 'Factory', ->
|
|
45
45
|
result = Factory.create 'something-with-traits'
|
46
46
|
result.traits.should.deep.equal ['something', 'with']
|
47
47
|
|
48
|
-
describe '#
|
48
|
+
describe '#is', ->
|
49
49
|
|
50
50
|
it 'checks if trait is set', ->
|
51
51
|
Factory.define 'hasTrait', ->
|
52
|
-
@
|
52
|
+
@is('hello')
|
53
53
|
|
54
54
|
Factory.create('hello-hasTrait').should.be.ok
|
55
55
|
Factory.create('bye-hasTrait').should.not.be.ok
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chai-backbone-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthijs Groen
|