[rspec-devel] [ rspec-Bugs-8928 ] rspec_on_rails 0.8.0-RC1 controller tests make double call to setup_with_fixtures

noreply at rubyforge.org noreply at rubyforge.org
Tue Feb 27 22:59:15 EST 2007


Bugs item #8928, was opened at 2007-02-28 02:12
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8928&group_id=797

>Category: rails plugin
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Nikolai Lugovoi (meadow)
>Assigned to: David Chelimsky (dchelimsky)
Summary:  rspec_on_rails 0.8.0-RC1  controller tests make double call to setup_with_fixtures

Initial Comment:
call to super in Spec::Rails::Runner::FunctionalEvalContext#setup results in double call to setup_with_fixtures.

The problem is described in details at
http://rubyforge.org/tracker/index.php?func=detail&aid=8894&group_id=797&atid=3150
and 
http://dev.rubyonrails.org/ticket/7665

So, here's my understanding (Mx are labels to distinguish methods):

first, active_record/fixtures.rb redefine TestCase#setup as TestCase#setup_with_fixtures (M1).

next, defining "setup" method in FunctionalEvalContext (M2) triggers TestCase.method_added, which makes M2 to be "setup_without_fixtures" and creates new "setup" method (M3) as 
def setup 
  setup_with_fixtures # (M1)
  setup_without_fixtures #(M2)
end

last, ControllerEvalContext also defines "setup" method (M4) and finally we have in runtime:

ControllerEvalContext#setup: (M4)
  calls super -> FunctionalEvalContext#setup (M3)

FunctionalEvalContext#setup: (M3)
  calls setup_with_fixtures -> method from fixtures.rb (M1) 
  calls setup_without_fixtures -> method from context/functional.rb (M2)

But #setup defined in context/functional.rb (M2)
  calls super -> that is again setup_with_fixtures (M1)

So, is call to "super" necessary in FunctionalEvalContext#setup or it can be safely removed?

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-02-28 03:59

Message:
It turns out that it is not necessary (I removed it and all specs passed), so it has been removed as of trunk rev 1549.

----------------------------------------------------------------------

Comment By: Nikolai Lugovoi (meadow)
Date: 2007-02-28 02:16

Message:
oops, rails trac ticket on my problem is at 
http://dev.rubyonrails.org/ticket/7672

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8928&group_id=797


More information about the rspec-devel mailing list