On Jun 29, 2010, at 2:50 AM, Timo Rößner wrote: > On Jun 28, 5:35 pm, David Chelimsky <dchelim...@gmail.com> wrote: >> On Jun 28, 2010, at 10:30 AM, Timo Rößner wrote: >>> On Jun 28, 5:03 pm, David Chelimsky <dchelim...@gmail.com> wrote: >>>> On Jun 28, 2010, at 10:00 AM, Timo Rößner wrote: >> >>>>> Hey guys, >> >>>>> I let the code speak for itself: >> >>>>> Below are my currently failing specs, please don't pay too much >>>>> attention to the specs themselves, I just want to give you a "real >>>>> life example" of what's happening - the only interesting thing about >>>>> the specs is that there is a call to Factory(:challenge) in each of >>>>> them and a before-each-call putting out what's currently in the >>>>> database: >> >>>>> describe 'featuring' do >> >>>>> before(:each) do >>>>> puts "Before Each:" >>>>> puts "Featured Challenges size: #{Challenge.featured.size}" >>>>> puts "Challenges count: #{Challenge.count}" >>>>> end >> >>>>> it 'should tell if a challenge is featured' do >>>>> challenge = Factory(:challenge, :feature_position => 1) >>>>> challenge.should be_featured >>>>> end >> >>>>> it 'should tell if a challenge is not featured' do >>>>> challenge = Factory(:challenge, :feature_position => 0) >>>>> challenge.should_not be_featured >>>>> end >> >>>>> it 'should feature a challenge' do >>>>> challenge = Factory(:challenge) >>>>> challenge.feature! >>>>> Challenge.featured.should == [challenge] >>>>> end >> >>>>> it 'should unfeature a challenge' do >>>>> challenge = Factory(:challenge, :feature_position => 1) >>>>> challenge.unfeature! >>>>> Challenge.featured.should be_empty >>>>> end >>>>> end >> >>>>> Now to the interesting part: >> >>>>> A spec run using rails 2.3.5 and rspec 1: >> >>>>> bundle exec spec spec/models/challenge_spec.rb >>>>> Before Each: >>>>> Featured Challenges size: 0 >>>>> Challenges count: 0 >>>>> .Before Each: >>>>> Featured Challenges size: 0 >>>>> Challenges count: 0 >>>>> .Before Each: >>>>> Featured Challenges size: 0 >>>>> Challenges count: 0 >>>>> .Before Each: >>>>> Featured Challenges size: 0 >>>>> Challenges count: 0 >>>>> .............................. >> >>>>> -> Looks good. >> >>>>> Here's the exact same spec run with rspec-2.0.0.beta.13 and >>>>> rails-3.0.0.beta4: >> >>>>> Before Each: >>>>> Featured Challenges size: 0 >>>>> Challenges count: 0 >>>>> Before Each: >>>>> Featured Challenges size: 1 >>>>> Challenges count: 1 >>>>> .Before Each: >>>>> Featured Challenges size: 1 >>>>> Challenges count: 2 >>>>> Before Each: >>>>> Featured Challenges size: 2 >>>>> Challenges count: 3 >> >>>>> So apparently the latest rspec doesn't clean up after examples at all? >> >>>>> Is this a bug or a feature? >> >>>> Bug, but please check if it's still true of beta.14.1. >> >>> Hey David, >> >>> I just tried it out using the latest rspec and rspec-rails: >> >>> Gemfile: >> >>> gem 'rspec', '2.0.0.beta.14' >>> gem 'rspec-rails', '2.0.0.beta.14.1 >> >>> $ bundle show rspec >>> ~/.bundle/ruby/1.8/gems/rspec-2.0.0.beta.14 >> >>> $bundle show rspec-rails >>> ~/.bundle/ruby/1.8/gems/rspec-rails-2.0.0.beta.14.1 >> >>> Unfortunately, the bug still exists when using this configuration: >> >>> Before Each: >>> Featured Challenges size: 0 >>> Challenges count: 0 >>> .Before Each: >>> Featured Challenges size: 1 >>> Challenges count: 1 >>> .Before Each: >>> Featured Challenges size: 1 >>> Challenges count: 2 >>> FBefore Each: >>> Featured Challenges size: 2 >>> Challenges count: 3 >> >> What's in your Gemfile and spec/spec_helper.rb? >> >> ps - please post in-line or at the bottom so we can follow the thread.
> Hi David, > > -> http://gist.github.com/456941 I forked and made a couple of changes: http://gist.github.com/457034 * Added :development to the group declaration on line 31 * Changed rspec-rails to beta.14.2 * Removed the rspec declaration (it's a dependency of rspec-rails, so unnecessary) * Changed what is now line 44 to what gets generated now Not sure if this will fix anything, but let's see. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users