Ticket #280 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

merb_rspec.rb: "singularize" undefined

Reported by: james.herdm..@gmail.com Assigned to:
Priority: major Milestone: 0.4.1
Component: Rspec Harness Keywords:
Cc:

Description

Merb RSpec reports that "singularize" is not defined:

jherdman:(~/Projects/tumbledor) autotest
loading autotest/merb_rspec
/usr/local/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/autotest/merb_rspec.rb:34:in `initialize': undefined method `singularize' for "posts":String (NoMethodError)

How to replicate:

1. Create a "fixtures" folder under the "spec" folder. 2. Create a new YAML file for some object with a pluralized named. 3. Start autotest.

Since "singularize" is definitely defined in Merb's core extensions, it looks like this is just a matter of telling these to load before Merb RSpec.

Attachments

autotest_runs_but_is_funky.diff (395 bytes) - added by james.herdm..@gmail.com on 11/08/07 22:47:35.
Initial patch attempt
autotest_works_but_still_stops_difficultly.diff (356 bytes) - added by james.herdm..@gmail.com on 11/10/07 18:17:58.
Autotest now works, but it's still very difficult to stop it.

Change History

11/08/07 22:47:12 changed by james.herdm..@gmail.com

I've done a little snooping around and I've got autotest running with fixtures, but things seem a little off. I'll attach a file in a moment, but here's my output of starting autotest after my patch:

loading autotest/merb_rspec
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1/lib/mongrel/cgi.rb:165: warning: method redefined; discarding old env_table
/usr/local/lib/ruby/gems/1.8/gems/merb-0.4.1/lib/merb.rb:58: warning: method redefined; discarding old config
/usr/local/bin/ruby -S /usr/local/bin/spec  spec/models/dog_spec.rb
Started merb_init.rb ...
Connecting to database...
Loading Application...
Compiling routes..
Loaded DEVELOPMENT Environment...
P

Finished in 0.072657 seconds

1 example, 0 failures, 1 pending

Pending:
Dog should have specs (Not Yet Implemented)

My patch is basically to require "config/boot", but that seems a tad heavy-handed.

11/08/07 22:47:35 changed by james.herdm..@gmail.com

  • attachment autotest_runs_but_is_funky.diff added.

Initial patch attempt

11/08/07 22:50:09 changed by james.herdm..@gmail.com

I should also note that it's damn near impossible to quit autotest after my patch, more so than before.

11/10/07 17:48:15 changed by iv..@gweezlebur.com

What about adding "require 'merb/core_ext/inflections'" to the top of merb_rspec?

11/10/07 18:14:54 changed by james.herdm..@gmail.com

Alas, I get an error as follows:

jherdman:(~/Projects/testblog) autotest
loading autotest/merb_rspec
Autotest style autotest/merb_rspec doesn't seem to exist. Aborting.

if I make a change like this:

require 'autotest/rspec'
require File.join("..", "merb", "core_ext", "inflector")

class Autotest::MerbRspec < Autotest::Rspec
  # etc...

11/10/07 18:15:42 changed by james.herdm..@gmail.com

Oh, I'm an idiot... see the attached patch for a solution.

11/10/07 18:17:58 changed by james.herdm..@gmail.com

  • attachment autotest_works_but_still_stops_difficultly.diff added.

Autotest now works, but it's still very difficult to stop it.

11/10/07 18:42:44 changed by iv..@gweezlebur.com

Define "it's still very difficult to stop it" ... ctrl-c ctrl-c is the standard for autotest (one ctrl-c causes a re-run of all specs/tests)

11/10/07 18:53:13 changed by iv..@gweezlebur.com

  • status changed from new to closed.
  • resolution set to fixed.

(In [927]) merb_rspec autotest handler needs merb's inflector (Closes #280)

11/11/07 00:54:49 changed by james.herdm..@gmail.com

I'm finding that instead of the standard double ctrl-c to stop autotest with Merb that I'm actually having to hold down ctrl-c for a period of time to repeatedly and quickly issue the command to stop autotest.