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
Kerel Lacy
8,474 Pointscannot 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.
11 Answers
Jason Seifer
Treehouse Guest TeacherHey 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.
Yaniv Ran
7,333 PointsThat solved my problem, thanks Jason.
Stephen Nguyen
860 Pointssudo chmod -R 755 $GEM_HOME/gems/shoulda-context-1.0.2 worked! thanks!
Jason Seifer
Treehouse Guest TeacherHi Kerel,
Can you zip up your treebook project and email it to help@teamtreehouse.com or send me a link on GitHub?
Kerel Lacy
8,474 PointsI sent the treebook project to help@teamtreehouse.com.
Thanks, Kerel
Ryan Johnson
991 PointsI'm experiencing the same 'cannot load such file -- shoulda/context (LoadError)' error. Has anyone determined the solution?
Kerel Lacy
8,474 PointsHi 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.
Ahad Shafiq
1,161 PointsI 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)
Ahad Shafiq
1,161 PointsHello,
I'm not sure if it'll work for everyone, but I fixed this problem by running:
rvm use 1.9.3-p194-perf
Ryan Johnson
991 PointsUnfortunately none of the proposed solutions work for me. Has anyone tried anything else that worked?
Kerel Lacy
8,474 PointsHey 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
Jake Rorrer
17,788 PointsJake Rorrer
17,788 PointsThis + Nima's solution did the trick. Thanks Jason!!