Skip to content

Commit

Permalink
Add missing test for setting tenant_id to same val
Browse files Browse the repository at this point in the history
This feature was added in
f4439e4,
but it looks like there wasn't an accompanying spec to cover the new
behavior.

Added the `require "yaml"` because I was getting a NameError; I guess
rails/all didn't cover that for some reason.
  • Loading branch information
calebhearth committed Jun 9, 2015
1 parent 6fb7218 commit 03a56b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/active_record_helper.rb
@@ -1,5 +1,6 @@
require 'rails/all'
require 'database_cleaner'
require 'yaml'

dbconfig = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'database.yml')))
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
Expand Down
9 changes: 9 additions & 0 deletions spec/acts_as_tenant/model_extensions_spec.rb
Expand Up @@ -27,6 +27,15 @@
it { expect {@project.account_id = @account.id + 1}.to raise_error }
end

describe 'setting tenant_id to the same value should not error' do
before do
@account = Account.create!(:name => 'foo')
@project = @account.projects.create!(:name => 'bar')
end

it { expect {@project.account_id = @account.id}.not_to raise_error }
end

describe 'tenant_id should be mutable, if not already set' do
before do
@account = Account.create!(:name => 'foo')
Expand Down

0 comments on commit 03a56b5

Please sign in to comment.