|
2 | 2 |
|
3 | 3 | describe "A class that is commentable" do
|
4 | 4 | it "can have many root comments" do
|
5 |
| - Commentable.new.comment_threads.respond_to?(:each).should be_true |
| 5 | + expect(Commentable.new.comment_threads.respond_to?(:each)).to eq(true) |
6 | 6 | end
|
7 | 7 |
|
8 | 8 | describe "when is destroyed" do
|
|
14 | 14 |
|
15 | 15 | it "also destroys its root comments" do
|
16 | 16 | @commentable.destroy
|
17 |
| - Comment.all.should_not include(@comment) |
| 17 | + expect(Comment.all).not_to include(@comment) |
18 | 18 | end
|
19 | 19 |
|
20 | 20 | it "also destroys its nested comments" do
|
|
23 | 23 | child.move_to_child_of(@comment)
|
24 | 24 |
|
25 | 25 | @commentable.destroy
|
26 |
| - Comment.all.should_not include(@comment) |
27 |
| - Comment.all.should_not include(child) |
| 26 | + expect(Comment.all).not_to include(@comment) |
| 27 | + expect(Comment.all).not_to include(child) |
28 | 28 | end
|
29 | 29 | end
|
30 | 30 |
|
|
45 | 45 | end
|
46 | 46 |
|
47 | 47 | it "should return the comments for the passed commentable" do
|
48 |
| - @comments.should include(@comment) |
| 48 | + expect(@comments).to include(@comment) |
49 | 49 | end
|
50 | 50 |
|
51 | 51 | it "should not return the comments for other commentables" do
|
52 |
| - @comments.should_not include(@other_comment) |
| 52 | + expect(@comments).not_to include(@other_comment) |
53 | 53 | end
|
54 | 54 | end
|
55 | 55 |
|
|
65 | 65 | end
|
66 | 66 |
|
67 | 67 | it "should return comments by the passed user" do
|
68 |
| - @comments.all? { |c| c.user == @user }.should be_true |
| 68 | + expect(@comments.all? { |c| c.user == @user }).to eq(true) |
69 | 69 | end
|
70 | 70 |
|
71 | 71 |
|
72 | 72 | it "should not return comments by other users" do
|
73 |
| - @comments.any? { |c| c.user != @user }.should be_false |
| 73 | + expect(@comments.any? { |c| c.user != @user }).to eq(false) |
74 | 74 | end
|
75 | 75 | end
|
76 | 76 | end
|
|
89 | 89 | end
|
90 | 90 |
|
91 | 91 | it "should return its own comments, ordered with the newest first" do
|
92 |
| - @comments.all? { |c| c.commentable_type == @commentable.class.to_s and c.commentable_id == @commentable.id }.should be_true |
93 |
| - @comments.each_cons(2) { |c, c2| c.created_at.should > c2.created_at } |
| 92 | + expect(@comments.all? { |c| c.commentable_type == @commentable.class.to_s and c.commentable_id == @commentable.id }).to eq(true) |
| 93 | + @comments.each_cons(2) { |c, c2| expect(c.created_at).to be > c2.created_at } |
94 | 94 | end
|
95 | 95 |
|
96 | 96 | it "should not include comments for other commentables" do
|
97 |
| - @comments.any? { |c| c.commentable_type != @commentable.class.to_s or c.commentable_id != @commentable.id }.should be_false |
| 97 | + expect(@comments.any? { |c| c.commentable_type != @commentable.class.to_s or c.commentable_id != @commentable.id }).to eq(false) |
98 | 98 | end
|
99 | 99 | end
|
100 | 100 | end
|
|
0 commit comments