[Rspec-devel] RSpec Extension Patch

Brian Takita brian.takita at gmail.com
Fri Jul 7 11:36:48 EDT 2006


Done.

Its at
http://rubyforge.org/tracker/index.php?func=detail&aid=4971&group_id=797&atid=3151

On 7/6/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
>
> On 7/7/06, Brian Takita <brian.takita at gmail.com> wrote:
> > Hello,
> >
> > Based off of the great feedback from the Test::Unit Integration thread,
> I
> > came up with a new patch that I think will be more useful.
> > I added the following methods, with tests!!!
> >
> > inherit
> >  includeWith inherit, you now get most of the "power" of the superclass.
> You
> > can use the class methods
> >
> > Now this is possible...
> > ----------------------------------------
> > require File.dirname(__FILE__) + '/../lib/spec'
> > require 'test/unit'
> >
> > class RspecIntegrationTest < Test::Unit::TestCase
> >   def self.a_class_method
> >     puts "a_class_method called"
> >   end
> >
> >   def self.fixtures(*args)
> >     puts "we can do fixtures too..."
> >   end
> >
> >   def setup
> >     @test_case_setup_called = true
> >   end
> >
> >   def teardown
> >     puts "Test::Unit::TestCase#teardown is called too"
> >   end
> >
> >   def run(result)
> >   end
> >
> >   def helper_method
> >     @helper_method_called = true
> >   end
> > end
> >
> > module RandomHelperModule
> >   def random_task
> >     @random_task_called = true
> >   end
> > end
> >
> > context "Rspec should integrate with Test::Unit::TestCase" do
> >   inherit RspecIntegrationTest
> >   a_class_method
> >   fixtures :some_table
> >   include RandomHelperModule
> >
> >   setup do
> >     @rspec_setup_called = true
> >   end
> >   specify "TestCase#setup should be called." do
> >     @test_case_setup_called.should_be true
> >     @rspec_setup_called.should_be true
> >   end
> >
> >   specify "Rspec should be able to access TestCase methods" do
> >     helper_method
> >     @helper_method_called.should_be true
> >   end
> >
> >   specify "Rspec should be able to accept included modules" do
> >     random_task
> >     @random_task_called.should_be true
> >   end
> > end
> >
> > -----------------------------------------------
> >
> > I havn't tried it, but adding integration tests should be as easy as...
> > ------------------------------------
> > context "Rspec should play with Integration Tests" do
> >   inherit ActionController::IntegrationTest
> > end
> > ------------------------------------
> > If this doesn't work right now, it doesn't seem like too much more
> effort to
> > implement.
> >
>
> Now, all of this looks really interesting!!
> If this solves the 'ouch we have to reimplement all of that rails
> testing stuff' problem it would be fantastic!
>
> Could you please create a patch in the issue tracker on rubyforge?
>
> Looking forward to playing more with this stuff!
>
> Cheers,
> Aslak
>
> > Thanks,
> > Brian Takita
> >
> > _______________________________________________
> > Rspec-devel mailing list
> > Rspec-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-devel
> >
> >
> >
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-devel/attachments/20060707/ef53178d/attachment.html 


More information about the Rspec-devel mailing list