summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorCallum Dryden <callum.dryden@rightscale.com>2017-02-16 09:48:29 +0000
committerCallum Dryden <callum.dryden@rightscale.com>2017-02-16 13:41:29 +0000
commita2c94aa6de8b6743488e9dba3693c847ad2b1bcd (patch)
tree9ed2fd247759fd774033c07d7734378e2fe35dc1 /spec
parent439bb066feb05403c7843fb6af65b83b453a0fd8 (diff)
downloadhashie-a2c94aa6de8b6743488e9dba3693c847ad2b1bcd.tar.gz
Ensure Railties available when loading Railtie
In some circumstances when a project has the Rails constant defined we may still not be able to require the rails/railtie dependency. Before this change this would raise an exception. This change seeks to add better detection of the railtie dependency and add logging that this dependency is missing but still allow execution to continue.
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/rails-without-dependency/.rspec3
-rw-r--r--spec/integration/rails-without-dependency/Gemfile4
-rw-r--r--spec/integration/rails-without-dependency/integration_spec.rb15
3 files changed, 22 insertions, 0 deletions
diff --git a/spec/integration/rails-without-dependency/.rspec b/spec/integration/rails-without-dependency/.rspec
new file mode 100644
index 0000000..a4c51e7
--- /dev/null
+++ b/spec/integration/rails-without-dependency/.rspec
@@ -0,0 +1,3 @@
+--colour
+--format=documentation
+--pattern=*_spec.rb
diff --git a/spec/integration/rails-without-dependency/Gemfile b/spec/integration/rails-without-dependency/Gemfile
new file mode 100644
index 0000000..85d86fe
--- /dev/null
+++ b/spec/integration/rails-without-dependency/Gemfile
@@ -0,0 +1,4 @@
+source 'http://rubygems.org'
+
+gem 'hashie', path: '../../..'
+gem 'rspec', '~> 3.5.0'
diff --git a/spec/integration/rails-without-dependency/integration_spec.rb b/spec/integration/rails-without-dependency/integration_spec.rb
new file mode 100644
index 0000000..34f8863
--- /dev/null
+++ b/spec/integration/rails-without-dependency/integration_spec.rb
@@ -0,0 +1,15 @@
+require 'rspec/core'
+
+RSpec.describe 'partial-rails' do
+ context 'when Rails constant is present but the railties are not' do
+ before(:all) do
+ class Rails
+ # A class about railways
+ end
+ end
+
+ it 'does not raise an exception when we require hashie' do
+ expect { require 'hashie' }.not_to raise_exception(LoadError)
+ end
+ end
+end