Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

cannot load such file -- shoulda/context (LoadError)

Hi Jason,

I'm still having problems with shoulda with the (LoadError) doesn't make creating test much fun here is my code when I try to run a test.

https://gist.github.com/lacykerel/4990117

11 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey all,

This took me a long time to figure out but I think I have a solution. Type "gem list" to get the list of your gems and take note of the version of "shoulda-context" that is installed. From there, type the following, substituting "1.0.2" with your version of the gem:

sudo chmod -R 755 $GEM_HOME/gems/shoulda-context-1.0.2

I'm not quite sure why this happens but it seems to be a permissions issue.

This + Nima's solution did the trick. Thanks Jason!!

That solved my problem, thanks Jason.

sudo chmod -R 755 $GEM_HOME/gems/shoulda-context-1.0.2 worked! thanks!

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hi Kerel,

Can you zip up your treebook project and email it to help@teamtreehouse.com or send me a link on GitHub?

I sent the treebook project to help@teamtreehouse.com.

Thanks, Kerel

I'm experiencing the same 'cannot load such file -- shoulda/context (LoadError)' error. Has anyone determined the solution?

Hi Ryan,

I'm going back and forth with Jason on trying to solve this error. You can try doing

bundle clean --force bundle install

Also go into your text/fixtures folder and make sure you have spaces instead of tabs for spacing.

bundle clean --force didn't know work for me due to some issues with bundler.

I have the same problem.

      bundle clean --force bundle install 

executes without errors but running

      rake db:migrate 

fails with:

      cannot load such file -- shoulda/context (LoadError)

Hello,

I'm not sure if it'll work for everyone, but I fixed this problem by running:

      rvm use 1.9.3-p194-perf  

Unfortunately none of the proposed solutions work for me. Has anyone tried anything else that worked?

Hey Ryan, still no solution yet, but I've been digging around the app. For some reason the shoulda gem when installed and configured shows up in the command line as using shoulda-matchers using shoulda-context

but we title the gem "require 'shoulda' "

Also within the tutorial Jason has us should context " insert test text" do

which also throws the error cannot load such file