Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Specs should pass with all supported options

  • Loading branch information...
commit 801081b1c1d12017040ce23ff51bc04ca4a42b3f 1 parent 557745d
@arvicco authored
View
2  Gemfile
@@ -12,3 +12,5 @@ gem "jquery-rails"
gem 'sqlite3', '> 1.3.3', :platforms => [:ruby_18, :ruby_19] #:ruby
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.2.2', :platforms => :jruby
gem 'jdbc-sqlite3', '>= 3.7.2', :platforms => :jruby
+
+gem "backports"
View
2  Gemfile.lock
@@ -43,6 +43,7 @@ GEM
multi_json (~> 1.0)
addressable (2.2.8)
arel (3.0.2)
+ backports (2.6.1)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
@@ -162,6 +163,7 @@ PLATFORMS
DEPENDENCIES
activerecord-jdbcsqlite3-adapter (>= 1.2.2)
+ backports
capybara
combustion
database_cleaner (>= 0.7.2)
View
3  app/controllers/ib/application_controller.rb
@@ -1,4 +1,5 @@
module Ib
- class ApplicationController < ::ApplicationController
+ class ApplicationController <
+ defined?(::ApplicationController) ? ::ApplicationController : ActionController::Base
end
end
View
7 lib/ib.rb
@@ -2,6 +2,11 @@ module IB
def self.db_backed?
!!defined?(IB::DB)
end
+
+ def self.rails?
+ !!defined?(Rails) && Rails.respond_to?('env')
+ end
+
end # module IB
IbRuby = IB
@@ -11,7 +16,7 @@ def self.db_backed?
# By default there is no DB backend, unless specifically requested
# require 'ib/db' # to make all IB models database-backed
-if defined?(Rails) && Rails.respond_to?('env')
+if IB.rails?
require 'ib/engine'
else
require 'ib/requires'
View
8 lib/ib/base.rb
@@ -53,6 +53,14 @@ def save
alias save! save
+ ### Noop methods mocking ActiveRecord::Base macros
+
+ def self.attr_protected *args
+ end
+
+ def self.attr_accessible *args
+ end
+
### ActiveRecord::Base association API mocks
def self.belongs_to model, *args
View
2  lib/ib/db.rb
@@ -26,6 +26,4 @@ def self.connect config
end # module DB
end
-# You may just require 'ib/db', it will then auto-require core 'ib' for you
-require 'ib'
View
2  lib/ib/engine.rb
@@ -1,6 +1,6 @@
module IB
class Engine < ::Rails::Engine
- isolate_namespace IB
+ isolate_namespace Ib
#paths["app"] # => ["app"]
#paths["app/controllers"] # => ["app/controllers"]
View
2  spec/my.rb
@@ -1,4 +1,4 @@
-# My very specific connection configuration to run specs
+# My very specific IB connection configuration to run the specs
ACCOUNT = 'DU118180'
HOST = '10.211.55.2'
View
16 spec/spec_helper.rb
@@ -33,10 +33,11 @@
}
end
-puts 'Running specs with OPTS:'
-pp OPTS
-
RSpec.configure do |config|
+
+ puts "Running specs '#{config.pattern}' with OPTS:"
+ pp OPTS
+
# config.filter = { :focus => true }
# config.include(UserExampleHelpers)
# config.mock_with :mocha
@@ -82,14 +83,5 @@
config.include Capybara::DSL,
:example_group => { :file_path => /\brails_spec\//}
- else
- # We need to prevent loading Rails-related spec files unless Rails support was required
- # However, when spec_helper.rb is first required, we're already inside a
- # config.load_spec_files cycle
- p config.pattern
- p config.files_to_run
- config.files_to_run = config.files_to_run.reject {|path| path =~ /rails/}
- p config.files_to_run
-
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.