Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Rewritten rspec integration to use RSpec's configure for matchers loading #204

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+19 −33
Split
@@ -1,42 +1,28 @@
# :enddoc:
+require 'rspec'
-require 'shoulda/matchers/independent'
-module RSpec::Matchers
- include Shoulda::Matchers::Independent
-end
+RSpec.configure do |config|
+ require 'shoulda/matchers/independent'
+ config.include Shoulda::Matchers::Independent
-if defined?(::ActiveRecord)
- require 'shoulda/matchers/active_record'
- require 'shoulda/matchers/active_model'
- module RSpec::Matchers
- include Shoulda::Matchers::ActiveRecord
- include Shoulda::Matchers::ActiveModel
- end
-elsif defined?(::ActiveModel)
- require 'shoulda/matchers/active_model'
- module RSpec::Matchers
- include Shoulda::Matchers::ActiveModel
+ if defined?(::ActiveRecord)
+ require 'shoulda/matchers/active_record'
+ require 'shoulda/matchers/active_model'
+ config.include Shoulda::Matchers::ActiveRecord
+ config.include Shoulda::Matchers::ActiveModel
+
+ elsif defined?(::ActiveModel)
+ require 'shoulda/matchers/active_model'
+ config.include Shoulda::Matchers::ActiveModel
end
-end
-if defined?(::ActionController)
- require 'shoulda/matchers/action_controller'
- module RSpec
- module Rails
- module ControllerExampleGroup
- include Shoulda::Matchers::ActionController
- end
- end
+ if defined?(::ActionController)
+ require 'shoulda/matchers/action_controller'
+ config.include Shoulda::Matchers::ActionController
end
-end
-if defined?(::ActionMailer)
- require 'shoulda/matchers/action_mailer'
- module RSpec
- module Rails
- module MailerExampleGroup
- include Shoulda::Matchers::ActionMailer
- end
- end
+ if defined?(::ActionMailer)
+ require 'shoulda/matchers/action_mailer'
+ config.include Shoulda::Matchers::ActionMailer
end
end