chai-backbone-rails 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,96 +0,0 @@
1
- #= require ./../chai-sinon
2
-
3
- describe "Sinon Chai Matchers", ->
4
-
5
- callback = null
6
-
7
- beforeEach -> callback = sinon.spy()
8
-
9
- describe "not have been called", ->
10
-
11
- it "passes if not called", ->
12
- expect(-> callback.should.not.have.been.called).to.not.throw()
13
-
14
- it "raises AsserionError if called", ->
15
- callback()
16
- expect(-> callback.should.not.have.been.called).throw(/been called/)
17
-
18
- describe "called", ->
19
-
20
- describe "#exactly", ->
21
- it "raises AssertionError if not called", ->
22
- expect(-> callback.should.have.been.called.exactly(2).times).to.throw(/been called exactly twice, but it was called 0 times/)
23
-
24
- it "passes if matches", ->
25
- callback()
26
- expect(-> callback.should.have.been.called.exactly(1).time).to.not.throw()
27
-
28
- it "raises AssertionError if called more than specified", ->
29
- callback()
30
- callback()
31
- callback()
32
- callback()
33
- expect(-> callback.should.have.been.called.exactly(3).times).to.throw(/been called exactly thrice, but it was called 4 times/)
34
-
35
- describe "#before", ->
36
- second = null
37
-
38
- beforeEach -> second = sinon.spy()
39
-
40
- it "raises AssertionError if first not called", ->
41
- second()
42
- expect(-> callback.should.have.been.called.before(second)).to.throw(/been called before/)
43
-
44
- it "passes if second not called", ->
45
- callback()
46
- expect(-> callback.should.have.been.called.before(second)).to.not.throw()
47
-
48
- it "raises AssertionError if order is wrong", ->
49
- second()
50
- callback()
51
- expect(-> callback.should.have.been.called.before(second)).to.throw(/been called before/)
52
-
53
- it "passes if second if spies are called in correct order", ->
54
- callback()
55
- second()
56
- expect(-> callback.should.have.been.called.before(second)).to.not.throw()
57
-
58
- describe "#after", ->
59
- second = null
60
-
61
- beforeEach -> second = sinon.spy()
62
-
63
- it "raises AssertionError if first not called", ->
64
- second()
65
- expect(-> callback.should.have.been.called.after(second)).to.throw(/been called before/)
66
-
67
- it "raises AssertionError if second not called", ->
68
- callback()
69
- expect(-> callback.should.have.been.called.after(second)).to.throw(/been called before/)
70
-
71
- it "raises AssertionError if order is wrong", ->
72
- callback()
73
- second()
74
- expect(-> callback.should.have.been.called.after(second)).to.throw(/been called before/)
75
-
76
- it "passes if second if spies are called in correct order", ->
77
- second()
78
- callback()
79
- expect(-> callback.should.have.been.called.after(second)).to.not.throw()
80
-
81
- describe "#with", ->
82
-
83
- it "raises AssertionError if callback not called", ->
84
- expect(-> callback.should.have.been.called.with(1)).to.throw(/been called with arguments/)
85
-
86
- it "passes if parameters match exactly", ->
87
- callback(1)
88
- expect(-> callback.should.have.been.called.with(1)).to.not.throw()
89
-
90
- it "raises AssertionError if parameters do not match", ->
91
- callback(4)
92
- expect(-> callback.should.have.been.called.with(5)).to.throw(/been called with arguments/)
93
-
94
- it "passes if more than specified parameters are passed", ->
95
- callback(1,2,3)
96
- expect(-> callback.should.have.been.called.with(1,2)).to.not.throw()