diff --git a/app/models/client.rb b/app/models/client.rb index 6d36e4efc..c4ba8133c 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -35,7 +35,7 @@ class Client < ActiveRecord::Base validates_uniqueness_of :symbol, message: "This Client ID has already been taken" validates_format_of :contact_email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i validates_inclusion_of :role_name, :in => %w( ROLE_DATACENTRE ), :message => "Role %s is not included in the list" - validates_inclusion_of :client_type, :in => %w( repository serial other ), :message => "Client type %s is not included in the list", if: :client_type? + validates_inclusion_of :client_type, :in => %w( repository periodical other ), :message => "Client type %s is not included in the list", if: :client_type? validates_associated :provider validate :check_id, :on => :create validate :freeze_symbol, :on => :update diff --git a/spec/requests/clients_spec.rb b/spec/requests/clients_spec.rb index 9726b51e4..6c30a5f22 100644 --- a/spec/requests/clients_spec.rb +++ b/spec/requests/clients_spec.rb @@ -111,6 +111,14 @@ relationships = json.dig('data', 'relationships') expect(relationships.dig("provider", "data", "id")).to eq(provider.symbol.downcase) + + Client.import + sleep 1 + + get '/clients', nil, headers + + expect(json['data'].size).to eq(2) + expect(json.dig('meta', 'clientTypes')).to eq([{"count"=>1, "id"=>"repository", "title"=>"Repository"}]) end end