[rspec-devel] rspec + edge rails

Pat Maddox pergesu at gmail.com
Fri Sep 28 22:17:09 EDT 2007


On 9/28/07, James Hughes <hughes.james at gmail.com> wrote:
> On 9/28/07, Pat Maddox <pergesu at gmail.com> wrote:
> > Is anyone successfully using rspec with edge rails?  I just tried to
> > get on edge today so that I can use activeresource, but first it
> > complained that ActionView::Helpers::JavaScriptMacrosHelper doesn't
> > exist anymore.  So I took that reference out.  Then it said that
> > there's no "Test::Unit.run=" method, so I took that line out.  Now
> > it's leaving me with
> >
> > NameError in 'Person finding a person when the record exists should
> > find the db record'
> > undefined local variable or method `method_name' for [RSpec
> > example]:#<Class:0x143c834>
> > /Users/pergesu/twistage_trunk/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/model.rb:12:in
> > `before_eval'
> > ./script/spec:4:
> >
> > I'm pretty confused because the only reference to method_name anywhere
> > in the rspec code is in method_missing in
> > Spec::DSL::BehaviourEval::ModuleMethods.
> >
> > That's the entire error message btw, there's nothing else.
> >
> > So, any clues on where they're clashing?
> >
> > Pat
>
> I'm using edge rails and rspec trunk and haven't seen these. Haven't
> really put that setup  through it's paces yet, though. If you tell me
> what you are running to get that error printed I'll try the same thing
> here.
>
> James
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>

hrm.  I was actually just starting a new app for testing purposes.
Anyway, here are the steps (I'm doing a brand new one now)

rails --database=sqlite3 test_app
svn export http://svn.rubyonrails.org/rails/trunk/ rails (r7675)
svn export svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec (r2677)
svn export svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec_on_rails (r2677)

I generated rspec and an rspec_model.  Just added two columns, name
and age.  Here's the spec:

describe Person do
  before(:each) do
    @person = Person.new :name => "Pat"
  end

  it "should have a name" do
    @person.name.should == "Pat"
  end
end

Running script/spec spec/model/person_spec.rb gives me

/Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:263:in
`load_missing_constant': uninitialized constant
ActionView::Helpers::JavaScriptMacrosHelper (NameError)
        from /Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:453:in
`const_missing'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/helper.rb:31
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
        from /Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in
`require'
        from /Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in
`new_constants_in'
        from /Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in
`require'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour.rb:8
         ... 25 levels...
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:49:in
`prepare!'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:19:in
`run'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/command_line.rb:17:in
`run'
        from ./script/spec:4


So I took out line 31 of helper.rb, run the spec again and get

/Users/pergesu/work/test_app/vendor/plugins/rspec_on_rails/lib/spec/rails.rb:20:
undefined method `run=' for Test::Unit:Module (NoMethodError)
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
        from /Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in
`require'
        from /Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in
`new_constants_in'
        from /Users/pergesu/work/test_app/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in
`require'
        from ./spec/models/../spec_helper.rb:5
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
        from ./spec/models/person_spec.rb:1
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:106:in
`load'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:106:in
`load_specs'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:105:in
`each'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:105:in
`load_specs'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:49:in
`prepare!'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:19:in
`run'
        from /Users/pergesu/work/test_app/vendor/plugins/rspec/lib/spec/runner/command_line.rb:17:in
`run'
        from ./script/spec:4


So I took out "Test::Unit.run = true" from rails.rb, run again and get

baggio:~/work/test_app pergesu$ ./script/spec spec/models/person_spec.rb
F

1)
NameError in 'Person should have a name'
undefined local variable or method `method_name' for [RSpec
example]:#<Class:0x242339c>
/Users/pergesu/work/test_app/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/model.rb:12:in
`before_eval'
./script/spec:4:

Finished in 0.015112 seconds

1 example, 1 failure

What revisions do you have of rails and rspec?

Pat


More information about the rspec-devel mailing list