I'm using Middleman v4 and I'm having issues in both the console and when I use RSpec to unit test my libraries.
Right now I comment out most of my config.rb
file, something like this.
require 'lib/foo'
require 'lib/bar'
#activate external_pipeline ...
#activate stuff
Activating features like the external pipeline causes problems in both console and when I'm unit testing. I could use environment variables and conditionals to fix the problem, but I was wondering if anyone has had to approach this issue.
I have solved the problem by wrapping all the configuration I don't want to run in RSpec tests or Middleman Console in a conditional statement.
#config.rb
...
unless ENV['NO_CONFIG']
...
end
Then I run my tests with the variable set to avoid the config I don't want.
NO_CONFIG=TRUE bundle exec rspec
I just feel like it's an ugly solution and I wish there were something more elegant in Middleman.