Skip to content

Commit

Permalink
Merge branch 'master' into create-agents
Browse files Browse the repository at this point in the history
  • Loading branch information
taitus committed Jan 29, 2018
2 parents 57b174e + 12c70f3 commit 1c3bc95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class OrganizationsController < ApplicationController

before_action :set_organization, only: :show

autocomplete :organization, :name
autocomplete :organization, :name, :display_value => :fullname

def index
@organizations = search(params)
Expand Down
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Organization < ActiveRecord::Base
scope :invalidated, -> { where('invalidated_at is not null') }
scope :validated, -> { where('invalidated_at is null') }
scope :lobbies, -> { where('entity_type = ?', 2) }
scope :full_like, ->(name) { where("identifier ilike ? OR name ilike ?", name, name) }
scope :full_like, ->(name) { where("identifier ilike ? OR name ilike ? OR first_surname ilike ?", name, name, name) }

def entity_type_id
Organization.entity_types[entity_type]
Expand Down
11 changes: 11 additions & 0 deletions spec/features/organizations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,17 @@
expect(page).to have_content "New text public assignments"
end

scenario "Should not display organization agent info allow_public_data: false" do
organization = create(:organization)
agent1 = create(:agent, organization: organization, to: Date.current, allow_public_data: true)
agent2 = create(:agent, organization: organization, to: Date.current, allow_public_data: false)

visit organization_path(organization)

expect(page).to have_content agent1.name
expect(page).not_to have_content agent2.name
end

scenario "Should display canceled organization but not display agent info" do
organization = create(:organization, canceled_at: Date.current)
agent = create(:agent, organization: organization)
Expand Down

0 comments on commit 1c3bc95

Please sign in to comment.