diff --git a/lib/passages.rb b/lib/passages.rb
index <HASH>..<HASH> 100644
--- a/lib/passages.rb
+++ b/lib/passages.rb
@@ -10,5 +10,7 @@ module Passages
   module_function :username, :password
 end
 
-require 'passages/engine'
-require 'controllers/passages/routes_controller'
+if defined? Rails
+  require 'passages/engine'
+  require 'controllers/passages/routes_controller'
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -2,3 +2,4 @@ require 'action_dispatch/routing'
 require 'action_dispatch/routing/inspector'
 require 'active_support'
 require 'action_controller'
+require './lib/passages'
Fix specs

Only load engine when Rails is defined