Phlip
2009-Feb-01 15:50 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
RSpeckers: I''m trying to install this into a Merb-generated RSpec rig: http://code.jeremyevans.net/doc/fixture_dependencies/ It requires inserting their test case into RSpec. This is the documented way to do it: describe ''Post'' do inherit FixtureDependencies::SequelTestCase And that leads to the syntax error in the subject line. (No stack trace is available - ask the Merb spec runner why!) Has anyone seen that one before? -- Phlip
Thomas R. Koll
2009-Feb-01 18:36 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
Hi Phlip, Are you sure it''s inherit and not extend? Second, I guess the missing trace is cuz you should put a ''before'' block into the describe. Took me some time to figure that out last month... so try this and let us know the results: describe ''Post'' do before do extend FixtureDependencies::SequelTestCase end end ciao, tom Am 01.02.2009 um 16:50 schrieb Phlip:> RSpeckers: > > I''m trying to install this into a Merb-generated RSpec rig: > > http://code.jeremyevans.net/doc/fixture_dependencies/ > > It requires inserting their test case into RSpec. This is the > documented way to do it: > > describe ''Post'' do > inherit FixtureDependencies::SequelTestCase > > And that leads to the syntax error in the subject line. (No stack > trace is available - ask the Merb spec runner why!) > > Has anyone seen that one before?-- Thomas R. "TomK32" Koll <> http://ananasblau.com just a geek trying to change the world http://github.com/TomK32
Phlip
2009-Feb-01 20:42 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
Thomas R. Koll wrote:> Are you sure it''s inherit and not extend?Per the blogs, inherit() got invented to install Test::Unit::TestCase, to get its extra goodies. That''s a class, so you can''t extend or import it! Were those blog entries since redacted?> Second, I guess the missing trace is cuz you should > put a ''before'' block into the describe.Huh? The trace is just missing; test runners should propagate it.> describe ''Post'' do > before do > extend FixtureDependencies::SequelTestCase > end > endHere''s the relevant bits that don''t work. (I changed the goal library to the ''assert2'' patched into Test::Unit::Assertions.) require File.join( File.dirname(__FILE__), ''..'', "spec_helper" ) require ''test/unit'' require ''assert2'' describe ''Post'' do before do include Test::Unit::TestCase # inherit Test::Unit::TestCase # does not compile # include Test::Unit::Assertions # does not import assert{} end it ''should have fixtures'' do posts = posts(:Joan_Crawford_Has_Risen, :Jammin, :Sardonicus, :Lithium) posts[0].body.should == ''From the Grave'' posts[0].tags.should include(tags(:progressive)) # this line never compiles assert{ posts[0].tags.include? tags(:rocksteady) } end end The rspec-rails plugin sure has me spoiled, huh? I formerly thought Test::Unit::Assertions would be automatically available, even without Rails around... -- Phlip
Phlip
2009-Feb-03 02:19 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
I have to bump this one because it looks like it''s on RSpec''s core feature list, and I reeally need a fix for it. Feel free to blame Merb, if they munged the inherit() method somehow!> Here''s the relevant bits that don''t work. (I changed the goal library to > the ''assert2'' patched into Test::Unit::Assertions.) > > require File.join( File.dirname(__FILE__), ''..'', "spec_helper" ) > require ''test/unit'' > require ''assert2'' > > > describe ''Post'' do > > before do > include Test::Unit::TestCase > # inherit Test::Unit::TestCase # does not compile > # include Test::Unit::Assertions # does not import assert{} > end > > it ''should have fixtures'' do > posts = posts(:Joan_Crawford_Has_Risen, :Jammin, :Sardonicus, :Lithium) > posts[0].body.should == ''From the Grave'' > posts[0].tags.should include(tags(:progressive)) > > # this line never compiles > assert{ posts[0].tags.include? tags(:rocksteady) } > end > > end > > The rspec-rails plugin sure has me spoiled, huh? I formerly thought > Test::Unit::Assertions would be automatically available, even without > Rails around... >
Pat Maddox
2009-Feb-03 04:11 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
I''ll blame Merb on the basis that there is no "inherit" in RSpec. I''m guessing it''s some kind of merb extension. Pat On Mon, Feb 2, 2009 at 6:19 PM, Phlip <phlip2005 at gmail.com> wrote:> I have to bump this one because it looks like it''s on RSpec''s core feature > list, and I reeally need a fix for it. > > Feel free to blame Merb, if they munged the inherit() method somehow! > >> Here''s the relevant bits that don''t work. (I changed the goal library to >> the ''assert2'' patched into Test::Unit::Assertions.) >> >> require File.join( File.dirname(__FILE__), ''..'', "spec_helper" ) >> require ''test/unit'' >> require ''assert2'' >> >> >> describe ''Post'' do >> >> before do >> include Test::Unit::TestCase >> # inherit Test::Unit::TestCase # does not compile >> # include Test::Unit::Assertions # does not import assert{} >> end >> >> it ''should have fixtures'' do >> posts = posts(:Joan_Crawford_Has_Risen, :Jammin, :Sardonicus, :Lithium) >> posts[0].body.should == ''From the Grave'' >> posts[0].tags.should include(tags(:progressive)) >> >> # this line never compiles >> assert{ posts[0].tags.include? tags(:rocksteady) } >> end >> >> end >> >> The rspec-rails plugin sure has me spoiled, huh? I formerly thought >> Test::Unit::Assertions would be automatically available, even without Rails >> around... >> > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Phlip
2009-Feb-03 04:36 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
Pat Maddox wrote:> I''ll blame Merb on the basis that there is no "inherit" in RSpec. I''m > guessing it''s some kind of merb extension.http://blog.davidchelimsky.net/2007/4/1/rspec-plays-nice-with-others I know I know - time flies! If it has been superseded, then how do you inject a batch of assertions defined in someone else''s class into RSpec? For example, how does RSpec on Rails import its ActiveSupport::TestCase assertions?
Pat Maddox
2009-Feb-03 05:00 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
On Mon, Feb 2, 2009 at 8:36 PM, Phlip <phlip2005 at gmail.com> wrote:> Pat Maddox wrote: > >> I''ll blame Merb on the basis that there is no "inherit" in RSpec. I''m >> guessing it''s some kind of merb extension. > > http://blog.davidchelimsky.net/2007/4/1/rspec-plays-nice-with-others > > I know I know - time flies! > > If it has been superseded, then how do you inject a batch of assertions > defined in someone else''s class into RSpec? > > For example, how does RSpec on Rails import its ActiveSupport::TestCase > assertions?rspec-rails defines Spec::Rails::Example::RailsExampleGroup that inherits from ActiveSupport::TestCase. All other example groups are subclasses of REG. What you want to do is something along the lines of: class SequelExampleGroup < FixtureDependencies::SequelTestCase extend Spec::Example::ExampleGroupMethods include Spec::Example::ExampleMethods # also any other modules that contain merb-specific expectations Spec::Example::ExampleGroupFactory.register :sequel, self end describe ''Post'', :type => :sequel do ... end (I don''t know that that''s exactly it, but it should get you going) I think that forcing you to inherit from FixtureDependencies::SequelTestCase is pretty sucky and I''m not sure why they don''t just have some modules that you could mix in in the Spec::Runner.configure block. Pat
David Chelimsky
2009-Feb-03 05:05 UTC
[rspec-users] undefined method `inherit'' for Merb::Test::ExampleGroup
On Mon, Feb 2, 2009 at 10:36 PM, Phlip <phlip2005 at gmail.com> wrote:> Pat Maddox wrote: > >> I''ll blame Merb on the basis that there is no "inherit" in RSpec. I''m >> guessing it''s some kind of merb extension. > > http://blog.davidchelimsky.net/2007/4/1/rspec-plays-nice-with-others > > I know I know - time flies! > > If it has been superseded, then how do you inject a batch of assertions > defined in someone else''s class into RSpec?module MyMethods # define matchers end Spec::Runner.configure do |c| c.include MyMethods end That will include the module in every example group, regardless of the base class.> > For example, how does RSpec on Rails import its ActiveSupport::TestCase > assertions? > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Reasonably Related Threads
- undefined method `flunk' for #<Spec::Example::ExampleGroup::Subclass_1:0x0000000516bd40>
- ExampleGroup in Rspec 2
- undefined method `route_for' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:
- ExampleGroup and SharedExampleGroup relationship(?)
- [LLVMdev] Disabling Verifier