Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobb Kidd <robb@thekidds.org>2012-06-12 22:27:03 +0400
committerRobb Kidd <robb@thekidds.org>2012-06-20 22:09:46 +0400
commitdfb5da9da339096ad0a8e754f4f42ca2007b5ae6 (patch)
tree3d5464ebdcf31bd3bc3cf44a35e072aa1cde3849 /spec/spec_helper.rb
parent5303cc285a2067b59f1e8b68f707e8dbf90fe59e (diff)
Disable observers in specs. Enable only when observer is under test.
Used the built-in observer enable/disable feature in ActiveModel[1]. ActiveRecord::Base includes ActiveModel::Observing which provides this behavior. Simple wraps to enable the observer under test were added to the specs for: ActivityObserver, IssueObserver, Admin::Users and Issues. The spec for Project.last_activity was refactored to separate the tests for #last_activity and #last_activity_date. Each had doubles added to isolate the spec from the hidden dependency on the ActivityObserver action to create an Event for the project when an Issue is created. This ActivityObserver behavior is already tested by its spec. [1] http://api.rubyonrails.org/classes/ActiveModel/ObserverArray.html
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 18b7854d102..5556798f511 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -52,6 +52,7 @@ RSpec.configure do |config|
DatabaseCleaner.start
WebMock.disable_net_connect!(allow_localhost: true)
+ ActiveRecord::Base.observers.disable :all
end
config.after do