Skip to content

Commit

Permalink
'Real fixture done right' uses an approach that differs from the prev…
Browse files Browse the repository at this point in the history
…ious one.
  • Loading branch information
MitinPavel committed Oct 7, 2010
1 parent bee6fc9 commit 57ba2fc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions spec/real_fixture_done_right_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
require "#{File.dirname __FILE__}/../app/post.rb"

describe PostRepository, "#popular" do
before do
@popular_post = build_popular_post
@unpopular_post = build_unpopular_post
@repository = PostRepository.new [@popular_post, @unpopular_post]
end

it "should return a popular post" do
post = build_popular_post
repository = PostRepository.new [post]
repository.popular.should include(post)
@repository.popular.should include(@popular_post)
end

it "shouldn't return an unpopular post" do
post = build_unpopular_post
repository = PostRepository.new [post]
repository.popular.should_not include(post)
@repository.popular.should_not include(@unpopular_post)
end

def build_unpopular_post
Expand Down

0 comments on commit 57ba2fc

Please sign in to comment.