diff --git a/Gemfile b/Gemfile index d2ef306..3336044 100644 --- a/Gemfile +++ b/Gemfile @@ -73,6 +73,7 @@ group :test, :development do gem 'rspec-rails', '~> 3.1.0' gem 'rspec-its', '~> 1.1.0' gem 'rspec-collection_matchers', '~> 1.1.2' + gem 'rspec-mocks', '~> 3.1.3' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 700a33e..786c029 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -365,6 +365,7 @@ DEPENDENCIES rails_config (~> 0.4.2) rspec-collection_matchers (~> 1.1.2) rspec-its (~> 1.1.0) + rspec-mocks (~> 3.1.3) rspec-rails (~> 3.1.0) sass-rails (~> 4.0.4) seedbank (~> 0.3.0) diff --git a/app/models/domain/tree_structure.rb b/app/models/domain/tree_structure.rb index ba4ba08..533c87d 100644 --- a/app/models/domain/tree_structure.rb +++ b/app/models/domain/tree_structure.rb @@ -12,7 +12,7 @@ class Domain < ActiveRecord::Base after_save :sync_children # this goes after sync_parent, to order callbacks correctly - acts_as_nested_interval virtual_root: true, dependent: :nullify + acts_as_nested_interval virtual_root: true, dependent: :restrict_with_error validate :domain_ownership def domain_ownership diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index dde52a6..1437d8a 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -67,7 +67,7 @@ describe Domain do User.do_as(user) do # stub a parent domain on another user account, with no permissions present - mock_domain = mock( + mock_domain = double( :user_id => user3.id, :user => user3, :name => 'x',