<commit_before>require File.dirname(__FILE__) + '/../spec_helper'

describe User do

  # There are lots, LOTS more of these to do, I'm just keeping these here for examples:
  it { should validate_presence_of(:given_name) }
  it { should validate_uniqueness_of(:username) }
  it { should validate_confirmation_of(:entered_password) }

  it 'should be a curator (of the appropriate clade only) after approve_to_curate!' do
    Role.gen :title => 'Curator'

    bad_clade = HierarchyEntry.gen
    clade     = HierarchyEntry.gen
    user      = User.gen
    user.approve_to_curate! clade
    user.should be_a_curator_of(clade)
    user.should_not be_a_curator_of(bad_clade)
  end

end<commit_msg>added user curator test. refs EOLINFRASTRUCTURE-588<commit_after>require File.dirname(__FILE__) + '/../spec_helper'

describe User do
  scenario :foundation

  # There are lots, LOTS more of these to do, I'm just keeping these here for examples:
  it { should validate_presence_of(:given_name) }
  it { should validate_uniqueness_of(:username) }
  it { should validate_confirmation_of(:entered_password) }

  it 'should be a curator (of the appropriate clade only) after approve_to_curate!' do
    Role.gen :title => 'Curator'

    bad_clade = HierarchyEntry.gen
    clade     = HierarchyEntry.gen
    user      = User.gen
    user.approve_to_curate! clade
    user.should be_a_curator_of(clade)
    user.should_not be_a_curator_of(bad_clade)
  end

  it 'should be able to curate taxon' do
    tc = build_taxon_concept()

    curator = Factory(:curator, :username => 'test_curator',
                      :entered_password => '<PASSWORD>',
                      :curator_hierarchy_entry => HierarchyEntry.gen(:taxon_concept => tc))

    curator.can_curate_taxon_id?(tc.id).should be_true
  end
end
{'fraction_non_alphanumeric': 0.08826815642458101, 'fraction_numerical': 0.0016759776536312849, 'mean_word_length': 3.68848167539267, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '738996', 'n_tokens_mistral': 611, 'n_tokens_neox': 583, 'n_words': 150}