Skip to content

Commit

Permalink
Fix rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
Senen committed Nov 22, 2017
1 parent 1143888 commit 3e955e0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,21 @@ Rails/ActionFilter:
# Cop supports --auto-correct.
Rails/ApplicationRecord:
Exclude:
- 'app/models/agent.rb'
- 'app/models/area.rb'
- 'app/models/attachment.rb'
- 'app/models/attendee.rb'
- 'app/models/category.rb'
- 'app/models/event.rb'
- 'app/models/holder.rb'
- 'app/models/interest.rb'
- 'app/models/legal_representant.rb'
- 'app/models/manage.rb'
- 'app/models/organization.rb'
- 'app/models/organization_interest.rb'
- 'app/models/participant.rb'
- 'app/models/position.rb'
- 'app/models/represented_entity.rb'
- 'app/models/user.rb'

# Offense count: 3
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gem 'rails', '4.2.10'

gem 'ancestry', '~> 2.1.0'
gem 'cancancan', '~> 1.13.1'
gem 'cocoon', '~> 1.2.6'
gem 'cocoon', '~> 1.2.6'
gem 'coffee-rails', '~> 4.1.0'
gem 'devise', '~> 3.5', '>= 3.5.10'
gem 'devise-i18n', '~> 0.12.1'
Expand Down
2 changes: 1 addition & 1 deletion app/models/category.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Category < ActiveRecord::Base

has_many :organizations
has_many :organizations, dependent: :destroy

end
2 changes: 1 addition & 1 deletion app/models/interest.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Interest < ActiveRecord::Base

has_many :organization_interests
has_many :organization_interests, dependent: :destroy
has_many :organizations, through: :organization_interest

end
22 changes: 11 additions & 11 deletions app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ class Organization < ActiveRecord::Base
enum range_fund: [:range_1, :range_2, :range_3, :range_4]
enum entity_type: [:association, :federation, :lobby]

validates_uniqueness_of :inscription_reference, allow_blank: true, allow_nil: true
validates :inscription_reference, uniqueness: true, allow_blank: true, allow_nil: true

has_many :represented_entities
has_many :agents
has_many :organization_interests
has_many :interests, through: :organization_interests
has_many :subventions
has_many :contracts
has_many :funds
has_one :comunication_representant
has_one :user
has_one :legal_representant
has_many :represented_entities, dependent: :destroy
has_many :agents, dependent: :destroy
has_many :organization_interests, dependent: :destroy
has_many :interests, through: :organization_interests, dependent: :destroy
has_many :subventions, dependent: :destroy
has_many :contracts, dependent: :destroy
has_many :funds, dependent: :destroy
has_one :comunication_representant, dependent: :destroy
has_one :user, dependent: :destroy
has_one :legal_representant, dependent: :destroy
belongs_to :category

end
2 changes: 1 addition & 1 deletion spec/factories/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
denied_public_data false
denied_public_events false
entity_type :lobby

trait :company do
name { Faker::Company.name }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

it "should not be valid when inscription_reference already exists" do
organization = create(:organization, inscription_reference: "XYZ")
create(:organization, inscription_reference: "XYZ")
another_organization = build(:organization, inscription_reference: "XYZ")

expect(another_organization).not_to be_valid
Expand Down

0 comments on commit 3e955e0

Please sign in to comment.