Fix post spec

* don't use `double` for queries
* use `second` instead of `at()`.
This commit is contained in:
Benjamin Neff 2017-08-06 22:47:33 +02:00
parent 29ab4d8242
commit f4136d4559
No known key found for this signature in database
GPG key ID: 971464C3F1A90194

View file

@ -65,12 +65,12 @@ describe Post, :type => :model do
it 'calls includes_for_a_stream' do
expect(Post).to receive(:includes_for_a_stream)
Post.for_a_stream(double, double)
Post.for_a_stream(Time.zone.now, "created_at")
end
it 'calls excluding_blocks if a user is present' do
expect(Post).to receive(:excluding_blocks).with(alice).and_return(Post)
Post.for_a_stream(double, double, alice)
Post.for_a_stream(Time.zone.now, "created_at", alice)
end
end
@ -168,7 +168,7 @@ describe Post, :type => :model do
it "returns them in reverse creation order" do
posts = Post.for_visible_shareable_sql(Time.now + 1, "created_at")
expect(posts.first.text).to eq("second")
expect(posts.at(1).text).to eq("first")
expect(posts.second.text).to eq("first")
expect(posts.last.text).to eq("alice - 5")
end
end