Problem: no such file to load -- shoulda/tasks

145 views
Skip to first unread message

Matt Southerden

unread,
Sep 15, 2008, 4:14:03 AM9/15/08
to shoulda
When I run rake. I'm getting the error:

"no such file to load -- shoulda/tasks"

I'm running rails 2.1.1 and Shoulda from master. I get the same thing
when creating a new rails project and installing Shoulda as the only
plugin.

Any ideas?

Thanks,
Matt

Josh

unread,
Sep 15, 2008, 8:42:02 AM9/15/08
to shoulda
If I were to guess, you've added "require 'shoulda/tasks'" to
Rakefile, and set it up as a gem in environment.rb, but not installed
it yet.

The issue is that the require happens before it's actually installed.
I've taken to doing this:

begin require 'shoulda/tasks' rescue LoadError end

You'll get the usually Rails complaints about the gem not being
installed, and this prevents rake from bailing if Shoulda isn't
installed yet. It works as normal when shoulda is installed.

Ryan McGeary

unread,
Sep 15, 2008, 9:03:08 AM9/15/08
to sho...@googlegroups.com
Nah, I'm able to reproduce Matt's problem when shoulda is installed as just a plugin.  I'm looking into this now.

-Ryan

Josh

unread,
Sep 15, 2008, 9:14:11 AM9/15/08
to shoulda
Really? I was testing using it as a plugin as I went along, and it
seems to work:

rails shouldatest
cd shouldatest
script/plugin install git://github.com/thoughtbot/shoulda.git
rake -T

Is there something I'm missing?

On Sep 15, 9:03 am, "Ryan McGeary" <ryan.mcge...@gmail.com> wrote:
> Nah, I'm able to reproduce Matt's problem when shoulda is installed as just
> a plugin.  I'm looking into this now.
> -Ryan
>

Ryan McGeary

unread,
Sep 15, 2008, 9:33:30 AM9/15/08
to sho...@googlegroups.com
Josh,

Not sure yet.  I just ran the same test you just ran against Rails 2.1.1 and rake barfs with the same error  Matt mentioned.

Keep in mind, I uninstalled the thoughtbot-shoulda gem for this test.  With the gem installed, it works fine, but if you're using shoulda as a plugin alone, the new shoulda/tasks organization isn't working.

It's very likely just a load path issue.  The plugin paths aren't loaded yet when shoulda/tasks is requested.

-Ryan

Matt Southerden

unread,
Sep 15, 2008, 9:39:20 AM9/15/08
to shoulda
Ryan/Josh,

I get the same behaviour whether I have the Shoulda gem installed or
not

Matt.

On Sep 15, 2:33 pm, "Ryan McGeary" <ryan.mcge...@gmail.com> wrote:
> Josh,
> Not sure yet.  I just ran the same test you just ran against Rails 2.1.1 and
> rake barfs with the same error  Matt mentioned.
>
> Keep in mind, I uninstalled the thoughtbot-shoulda gem for this test.  With
> the gem installed, it works fine, but if you're using shoulda as a plugin
> alone, the new shoulda/tasks organization isn't working.
>
> It's very likely just a load path issue.  The plugin paths aren't loaded yet
> when shoulda/tasks is requested.
>
> -Ryan
>

Ryan McGeary

unread,
Sep 15, 2008, 9:55:02 AM9/15/08
to sho...@googlegroups.com
I just pushed a fix for this problem.  Here's the lighthouse ticket to track it from here on out:

Matt, Thanks for catching this problem.  Please re-up your shoulda plugin.  To clear up your comment about the gem, which gem version did you have installed?  I was referring to the new thoughtbot-shoulda v2.0.0 gem.  If you had the v1.x shoulda gem installed, yes, you would have experienced the plugin problem regardless of whether the gem was installed or not.

Sorry if this problem affected or confused anyone else.  Feel free to post here or the lighthouse ticket if there are any outstanding issues with this.

-Ryan

Matt Southerden

unread,
Sep 15, 2008, 10:39:29 AM9/15/08
to shoulda
Thanks for the quick fix, Ryan. :)

This relative load paths stuff is a pain. It's caused a headache for
running rails tests from the shell and in TextMate in edge.

wall << head

Matt.

On Sep 15, 2:55 pm, "Ryan McGeary" <ryan.mcge...@gmail.com> wrote:
> I just pushed a fix for this problem.  Here's the lighthouse ticket to track
> it from here on out:http://thoughtbot.lighthouseapp.com/projects/5807-shoulda/tickets/75-...
>
> Matt, Thanks for catching this problem.  Please re-up your shoulda plugin.
>  To clear up your comment about the gem, which gem version did you have
> installed?  I was referring to the new thoughtbot-shoulda v2.0.0 gem.  If
> you had the v1.x shoulda gem installed, yes, you would have experienced the
> plugin problem regardless of whether the gem was installed or not.
>
> Sorry if this problem affected or confused anyone else.  Feel free to post
> here or the lighthouse ticket if there are any outstanding issues with this.
>
> -Ryan
>
Reply all
Reply to author
Forward
0 new messages