Skip to content

Commit

Permalink
Fix styling based on standardrb
Browse files Browse the repository at this point in the history
  • Loading branch information
patrotom committed Mar 23, 2021
1 parent 460f050 commit b0a3b76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/acts_as_tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def self.without_tenant(&block)

def self.with_mutable_tenant(&block)
ActsAsTenant.mutable_tenant!(true)
self.without_tenant(&block)
without_tenant(&block)
ensure
ActsAsTenant.mutable_tenant!(false)
end
Expand Down
1 change: 0 additions & 1 deletion lib/acts_as_tenant/model_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def validates_uniqueness_to_tenant(fields, args = {})
raise ActsAsTenant::Errors::ModelNotScopedByTenant unless respond_to?(:scoped_by_tenant?)

fkey = reflect_on_association(ActsAsTenant.tenant_klass).foreign_key
pkey = reflect_on_association(ActsAsTenant.tenant_klass).active_record_primary_key

validation_args = args.clone
validation_args[:scope] = if args[:scope]
Expand Down
10 changes: 4 additions & 6 deletions spec/models/model_extensions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@

describe "::with_mutable_tenant" do
it "should return the value of the block" do
value = ActsAsTenant.with_mutable_tenant do
"something"
end
value = ActsAsTenant.with_mutable_tenant { "something" }
expect(value).to eq "something"
end

Expand All @@ -373,13 +371,13 @@

describe 'mutability' do
before do
@account = Account.create!(:name => 'foo')
@project = @account.projects.create!(:name => 'bar')
@account = Account.create!(name: "foo")
@project = @account.projects.create!(name: "bar")
end

it "should allow tenant_id to change inside the block" do
new_account_id = @account.id + 1
expect{ ActsAsTenant.with_mutable_tenant { @project.account_id = new_account_id } }.to_not raise_error(ActsAsTenant::Errors::TenantIsImmutable)
expect { ActsAsTenant.with_mutable_tenant { @project.account_id = new_account_id } }.to_not raise_error(ActsAsTenant::Errors::TenantIsImmutable)
expect(@project.account_id).to eq new_account_id
end
end
Expand Down

0 comments on commit b0a3b76

Please sign in to comment.