Last week, my Cucumber tests started failing. All of them. Here is the error:
undefined method `split_stylesheet_link_tag' for #<#<Class:0x007ff9a433c390>:0x007ff9a6a848f8> (ActionView::Template::Error)
split_stylesheet_link_tag
is a method I have from the css_splitter gem. It's found in my application.html.haml
file. (Hence why all the tests are failing; they all use that main template.) Loading the view that the Cucumber test is trying to load works in development. In other words, this is only an issue in my test environment.
Here's where it gets weird. I was using RVM, and I had concluded it was an issue with my gemsets, because it's the gem that exposes that method. So I switched to rbenv, and ran the tests. They worked.
I'm not sure what I've changed in the meantime (I know, I know), but I'm getting that failure again. If you're interested in the backtrace, you can find it here.
What I've Tried
Googling around caused me to check the contents of .bundle/config
. It contains
BUNDLE_DISABLE_SHARED_GEMS: '1'
That sounded like something that could be a culprit, so I changed that to 0
and ran bundle install
. It changed it back to 1
.
One interesting thing is that when I run bundle install
in the root of this Rails app, I get this message:
Your bundle is complete!
It was installed into ./vendor/bundle
This didn't seem right.
I'm using rbenv-gemset
. When I ran cat .rbenv-gemsets
, I got global
. So I followed the docs for rbenv-gemsets
and changed global
to .gems
. The docs suggested that this would install the gems into the .gems
directory in my project root. Running bundle install
again gave me the same message about installing the gems into ./vendor/bundle
, and there isn't a .gems
directory in the root of my project. (I had assumed that adding .gems
would create one.)
I'm using tmux
, and wondering if that had something to do with it because of this issue, I tried running the tests outside of tmux
and got the same error.
I've also made sure that my .bash_profile
file contains eval "$(rbenv init -)"
and that I've gone back through the rbenv
setup. I've confirmed that both rbenv
and its shims directory are on my path.
I made sure that css_splitter
is in my Gemfile and is not nested under a group
.
I'm sort of grasping at straws here. Just throw out any ideas.