Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rewritten rspec integration to use RSpec's configure for matchers loa…

…ding.
  • Loading branch information...
commit e6e7927ab47f737d0359244a42b4fb5c0f642882 1 parent 656714c
@hron authored
Showing with 19 additions and 33 deletions.
  1. +19 −33 lib/shoulda/matchers/integrations/rspec.rb
View
52 lib/shoulda/matchers/integrations/rspec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.