Don't require ActiveResource tests under Rails 5
This commit is contained in:
parent
26522c6b78
commit
98ef8f67da
|
@ -1,8 +1,8 @@
|
||||||
require 'active_resource'
|
|
||||||
|
|
||||||
module UnitTests
|
module UnitTests
|
||||||
module ActiveResourceBuilder
|
module ActiveResourceBuilder
|
||||||
def self.configure_example_group(example_group)
|
def self.configure_example_group(example_group)
|
||||||
|
require 'active_resource'
|
||||||
|
|
||||||
example_group.include ActiveResourceBuilder
|
example_group.include ActiveResourceBuilder
|
||||||
|
|
||||||
example_group.after do
|
example_group.after do
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
module UnitTests
|
module UnitTests
|
||||||
module RailsVersions
|
module RailsVersions
|
||||||
|
extend self
|
||||||
|
|
||||||
def self.configure_example_group(example_group)
|
def self.configure_example_group(example_group)
|
||||||
example_group.include(self)
|
example_group.include(self)
|
||||||
example_group.extend(self)
|
example_group.extend(self)
|
||||||
|
@ -16,6 +18,10 @@ module UnitTests
|
||||||
def rails_4_x?
|
def rails_4_x?
|
||||||
rails_version =~ '~> 4.0'
|
rails_version =~ '~> 4.0'
|
||||||
end
|
end
|
||||||
|
j
|
||||||
|
def rails_lte_4?
|
||||||
|
rails_version <= 4
|
||||||
|
end
|
||||||
|
|
||||||
def rails_gte_4_1?
|
def rails_gte_4_1?
|
||||||
rails_version >= 4.1
|
rails_version >= 4.1
|
||||||
|
|
|
@ -291,6 +291,7 @@ raising a validation exception on failure.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if rails_lte_4?
|
||||||
context 'an active_resource model' do
|
context 'an active_resource model' do
|
||||||
context 'with the validation context' do
|
context 'with the validation context' do
|
||||||
it 'does not raise an exception' do
|
it 'does not raise an exception' do
|
||||||
|
@ -300,6 +301,7 @@ raising a validation exception on failure.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if rails_4_x?
|
if rails_4_x?
|
||||||
context 'against a pre-set password in a model that has_secure_password' do
|
context 'against a pre-set password in a model that has_secure_password' do
|
||||||
|
|
|
@ -12,7 +12,6 @@ end
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
UnitTests::ActiveModelHelpers.configure_example_group(config)
|
UnitTests::ActiveModelHelpers.configure_example_group(config)
|
||||||
UnitTests::ActiveModelVersions.configure_example_group(config)
|
UnitTests::ActiveModelVersions.configure_example_group(config)
|
||||||
UnitTests::ActiveResourceBuilder.configure_example_group(config)
|
|
||||||
UnitTests::ClassBuilder.configure_example_group(config)
|
UnitTests::ClassBuilder.configure_example_group(config)
|
||||||
UnitTests::ControllerBuilder.configure_example_group(config)
|
UnitTests::ControllerBuilder.configure_example_group(config)
|
||||||
UnitTests::I18nFaker.configure_example_group(config)
|
UnitTests::I18nFaker.configure_example_group(config)
|
||||||
|
@ -25,6 +24,10 @@ RSpec.configure do |config|
|
||||||
UnitTests::ColumnTypeHelpers.configure_example_group(config)
|
UnitTests::ColumnTypeHelpers.configure_example_group(config)
|
||||||
UnitTests::ValidationMatcherScenarioHelpers.configure_example_group(config)
|
UnitTests::ValidationMatcherScenarioHelpers.configure_example_group(config)
|
||||||
|
|
||||||
|
if UnitTests::RailsVersions.rails_lte_4?
|
||||||
|
UnitTests::ActiveResourceBuilder.configure_example_group(config)
|
||||||
|
end
|
||||||
|
|
||||||
config.include UnitTests::Matchers
|
config.include UnitTests::Matchers
|
||||||
|
|
||||||
config.infer_spec_type_from_file_location!
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
Loading…
Reference in New Issue