Enter the period or date associated with the subject of your %{work_type}.
Examples:
19th century
Middle Ages
Jurassic Period
"
creator:
- help: "
Enter the names of creators of the %{work_type}. This could include important authors, co-authors, or other significant contributors.
"
+ help: "
Enter the names of creators of the %{work_type}, in LastName, FirstName format. These could include important authors, co-authors, or other significant contributors.
"
cultural_context:
help: "
Enter the name of culture, people, or adjectival form of country associated with the subject of your %{work_type}.
Examples:
American
Vietnamese
Inuit
"
date_created:
diff --git a/db/migrate/20150423153556_add_family_name_and_given_name_to_user.rb b/db/migrate/20150423153556_add_family_name_and_given_name_to_user.rb
new file mode 100644
index 00000000..f0a3a9e9
--- /dev/null
+++ b/db/migrate/20150423153556_add_family_name_and_given_name_to_user.rb
@@ -0,0 +1,6 @@
+class AddFamilyNameAndGivenNameToUser < ActiveRecord::Migration
+ def change
+ add_column User.table_name, :first_name, :string
+ add_column User.table_name, :last_name, :string
+ end
+end
diff --git a/spec/controllers/curate/people_controller_spec.rb b/spec/controllers/curate/people_controller_spec.rb
index 67610eca..93a5736c 100644
--- a/spec/controllers/curate/people_controller_spec.rb
+++ b/spec/controllers/curate/people_controller_spec.rb
@@ -26,28 +26,28 @@
describe "searching via json" do
before(:each) do
- @katie = FactoryGirl.create(:person, name: 'Katie F. White-Kopp')
- @alvin = FactoryGirl.create(:person, name: 'A. S. Mitchell')
- @john = FactoryGirl.create(:person_with_user, name: 'John Corcoran III')
+ @katie = FactoryGirl.create(:person, first_name: 'Katie F.', last_name: 'White-Kopp')
+ @alvin = FactoryGirl.create(:person, first_name: 'A. S.', last_name: 'Mitchell')
+ @john = FactoryGirl.create(:person_with_user, first_name: 'John', last_name: 'Corcoran III')
end
it "should return results on full first name match" do
get :index, q: 'Katie', format: :json
json = JSON.parse(response.body)
- json['response']['docs'].should == [{"id"=>@katie.pid, "desc_metadata__name_tesim"=>["Katie F. White-Kopp"]}]
+ json['response']['docs'].should == [{"id"=>@katie.pid, "desc_metadata__first_name_tesim"=>["Katie F."], "desc_metadata__last_name_tesim"=>["White-Kopp"]}]
end
it "should return results on full last name match" do
get :index, q: 'Mitchell', format: :json
json = JSON.parse(response.body)
- json['response']['docs'].should == [{"id"=>@alvin.pid, "desc_metadata__name_tesim"=>["A. S. Mitchell"]}]
+ json['response']['docs'].should == [{"id"=>@alvin.pid, "desc_metadata__first_name_tesim"=>["A. S."], "desc_metadata__last_name_tesim"=>["Mitchell"]}]
end
describe "when constrained to users" do
it "should return users" do
get :index, q: '', user: true, format: :json
json = JSON.parse(response.body)
- json['response']['docs'].should == [{"id"=>@john.pid, "desc_metadata__name_tesim"=>["John Corcoran III"]}]
+ json['response']['docs'].should == [{"id"=>@john.pid, "desc_metadata__first_name_tesim"=>["John"], "desc_metadata__last_name_tesim"=>["Corcoran III"]}]
end
end
diff --git a/spec/curate/internal/factories.rb b/spec/curate/internal/factories.rb
index c5b35229..e06ed1df 100644
--- a/spec/curate/internal/factories.rb
+++ b/spec/curate/internal/factories.rb
@@ -3,7 +3,8 @@
FactoryGirl.define do
factory :user do
sequence(:email) {|n| "email-#{srand}@test.com" }
- sequence(:name) {|n| "User Named #{n}" }
+ sequence(:first_name) {|n| "First #{n}" }
+ sequence(:last_name) {|n| "Last #{n}" }
agreed_to_terms_of_service true
user_does_not_require_profile_update true
password 'a password'
diff --git a/spec/features/generic_work_spec.rb b/spec/features/generic_work_spec.rb
index 7eae3a01..4ec3daa6 100644
--- a/spec/features/generic_work_spec.rb
+++ b/spec/features/generic_work_spec.rb
@@ -139,14 +139,13 @@
end
describe 'When I click on the link to create a work: ' do
- let(:account) { FactoryGirl.create(:account, name: 'Iron Man') }
+ let(:account) { FactoryGirl.create(:account, first_name: 'Iron', last_name: 'Man') }
let(:user) { account.user }
let(:person) { account.person }
before { login_as(user) }
it 'should have my name set in the creator/contributor list' do
visit new_curation_concern_generic_work_path
- page.should have_css("a[href$='people/#{person.to_param}']")
- page.should have_tag("a[href$='people/#{person.to_param}']", text: "Iron Man")
+ page.should have_tag("input", value: "Man, Iron")
end
end
diff --git a/spec/features/manager_profile_workflow_spec.rb b/spec/features/manager_profile_workflow_spec.rb
index e6378ae6..130ba4cb 100644
--- a/spec/features/manager_profile_workflow_spec.rb
+++ b/spec/features/manager_profile_workflow_spec.rb
@@ -14,7 +14,8 @@
visit edit_user_path(user.id)
- new_name = 'Frodo Baggins'
+ new_first_name = 'Frodo'
+ new_last_name = 'Baggins'
new_pref = 'pref@example.com'
new_alt = 'alt@example.com'
new_title = 'student'
@@ -24,7 +25,8 @@
new_blog = 'blog.example.com'
within('form.edit_user') do
- fill_in("user[name]", with: new_name)
+ fill_in("user[first_name]", with: new_first_name)
+ fill_in("user[last_name]", with: new_last_name)
fill_in("user[email]", with: new_pref)
fill_in("user[alternate_email]", with: new_alt)
fill_in("user[title]", with: new_title)
@@ -43,7 +45,7 @@
user.person.reload
# Verify that everything got updated
- user.name.should == new_name
+ user.name.should == "#{new_first_name} #{new_last_name}"
user.email.should == new_pref
user.alternate_email.should == new_alt
user.title.should == new_title
diff --git a/spec/features/person_profile_spec.rb b/spec/features/person_profile_spec.rb
index 6fc5beb3..b59bdd18 100644
--- a/spec/features/person_profile_spec.rb
+++ b/spec/features/person_profile_spec.rb
@@ -4,7 +4,7 @@
context 'logged in user' do
let(:password) { FactoryGirl.attributes_for(:user).fetch(:password) }
- let(:account) { FactoryGirl.create(:account, name: 'Iron Man') }
+ let(:account) { FactoryGirl.create(:account, first_name: 'Iron', last_name: "Man") }
let(:user) { account.user }
let(:person) { account.person }
before { login_as(user) }
@@ -19,7 +19,8 @@
visit catalog_index_path
click_link 'My Profile'
click_link 'Update Personal Information'
- expect(page).to have_field('Name', with: 'Iron Man')
+ expect(page).to have_field('First name', with: 'Iron')
+ expect(page).to have_field('Last name', with: 'Man')
end
it 'should update their name and see the updated value' do
@@ -28,7 +29,8 @@
click_link 'Update Personal Information'
page.should have_link("Cancel", href: person_path(person))
within('form.edit_user') do
- fill_in("user[name]", with: 'Spider Man')
+ fill_in("user[first_name]", with: 'Spider')
+ fill_in("user[last_name]", with: 'Man')
fill_in("user[current_password]", with: password)
click_button "Update Account"
end
@@ -69,14 +71,21 @@
expect(page).to_not have_link('Marguerite Scypion') #title
end
end
+ end
+
+ context "searching" do
+ let!(:account) { FactoryGirl.create(:account, first_name: 'Bruce', last_name: 'Banner') }
+ let!(:user) { account.user }
+ let!(:person) { account.person }
+ before { login_as(user) }
it 'with edit access is displayed in the results' do
login_as(user)
create_work
visit catalog_index_path
- fill_in 'Search Curate', with: 'Hulk'
+ fill_in 'Search Curate', with: 'Bruce'
click_button 'keyword-search-submit'
within('#documents') do
- expect(page).to have_link('The Hulk') #title
+ expect(page).to have_link('Bruce Banner') #title
end
end
it 'should not show repository managers in search results' do
@@ -94,7 +103,7 @@
let(:email) { 'manager2@example.com' }
let(:manager_user) { FactoryGirl.create(:user, email: email) }
- let(:manager_2) {FactoryGirl.create(:account, email: 'manager@example.com', name: 'Stan Theman')}
+ let(:manager_2) {FactoryGirl.create(:account, email: 'manager@example.com', first_name: 'Stan', last_name: 'Theman')}
let!(:user) {manager_2.user}
let!(:person) {manager_2.person}
@@ -113,7 +122,7 @@
context 'A person when logged in' do
let(:password) { FactoryGirl.attributes_for(:user).fetch(:password) }
- let(:account) { FactoryGirl.create(:account, name: 'Iron Man') }
+ let(:account) { FactoryGirl.create(:account, first_name: 'Iron', last_name: 'Man') }
let(:user) { account.user }
let(:person) { account.person }
let(:image_file){ Rails.root.join('../fixtures/files/image.png') }
diff --git a/spec/features/user_profile_workflow_spec.rb b/spec/features/user_profile_workflow_spec.rb
index 20be296a..95a8ec0a 100644
--- a/spec/features/user_profile_workflow_spec.rb
+++ b/spec/features/user_profile_workflow_spec.rb
@@ -12,7 +12,8 @@
visit edit_user_registration_path
- new_name = 'Frodo Baggins'
+ new_first_name = 'Frodo'
+ new_last_name = 'Baggins'
new_pref = 'pref@example.com'
new_alt = 'alt@example.com'
new_title = 'student'
@@ -23,7 +24,8 @@
within('form.edit_user') do
fill_in("user[current_password]", with: password)
- fill_in("user[name]", with: new_name)
+ fill_in("user[first_name]", with: new_first_name)
+ fill_in("user[last_name]", with: new_last_name)
fill_in("user[email]", with: new_pref)
fill_in("user[alternate_email]", with: new_alt)
fill_in("user[title]", with: new_title)
@@ -42,7 +44,7 @@
user.person.reload
# Verify that everything got updated
- user.name.should == new_name
+ user.name.should == "#{new_first_name} #{new_last_name}"
user.email.should == new_pref
user.alternate_email.should == new_alt
user.title.should == new_title
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 0593882c..f9c0d352 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -70,18 +70,19 @@
end
it 'if the person name changes, it keeps profile title in sync' do
- new_name = 'Meriadoc Brandybuck'
- subject.update_with_password(current_password: password, name: new_name)
- person.name.should == new_name
+ new_first_name = 'Meriadoc'
+ new_last_name = 'Brandybuck'
+ subject.update_with_password(current_password: password, first_name: new_first_name, last_name: new_last_name)
person.profile.reload
- person.profile.title.should == new_name
+ person.profile.title.should == "#{new_first_name} #{new_last_name}"
end
it 'if the person name changes, it keeps the user.name in sync' do
- new_name = 'Meriadoc Brandybuck'
- subject.update_with_password(current_password: password, name: new_name)
- person.name.should == new_name
- person.user.name.should == new_name
+ new_first_name = 'Meriadoc'
+ new_last_name = 'Brandybuck'
+ subject.update_with_password(current_password: password, first_name: new_first_name, last_name: new_last_name)
+ person.name.should == "#{new_first_name} #{new_last_name}"
+ person.user.name.should == "#{new_first_name} #{new_last_name}"
end
end
@@ -100,7 +101,7 @@
describe '#save via .new_with_session' do
let(:expected_name) { 'Robert Frost' }
- let(:attributes) { FactoryGirl.attributes_for(:user, name: expected_name) }
+ let(:attributes) { FactoryGirl.attributes_for(:user, first_name: 'Robert', last_name: 'Frost') }
let(:session) { {} }
subject { Account.new_with_session(attributes, session) }
@@ -155,8 +156,7 @@
subject { Account.new(user) }
it 'has a default title for the profile' do
- subject.name.should == user.name
- subject.profile.title.should == user.name
+ subject.profile.title.should == "Profile"
end
end
diff --git a/spec/views/registrations/edit.html.erb_spec.rb b/spec/views/registrations/edit.html.erb_spec.rb
new file mode 100644
index 00000000..f47cb760
--- /dev/null
+++ b/spec/views/registrations/edit.html.erb_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe 'registrations/edit' do
+ let(:person) { FactoryGirl.create(:person_with_user) }
+ let(:user) { person.user }
+
+ before do
+ view.stub(:current_user).and_return(user)
+ view.stub(:resource).and_return(user)
+ view.stub(:resource_name).and_return(user)
+ view.stub(:devise_mapping).and_return(Devise.mappings[:user])
+ render
+ end
+
+ it 'displays password fields with autocomplete turned off' do
+ expect(rendered).to have_tag('input[autocomplete=off]', count: 3)
+ end
+end
diff --git a/spec/views/shared/_site_actions.html.erb_spec.rb b/spec/views/shared/_site_actions.html.erb_spec.rb
index 5b069b40..e46727f4 100644
--- a/spec/views/shared/_site_actions.html.erb_spec.rb
+++ b/spec/views/shared/_site_actions.html.erb_spec.rb
@@ -21,8 +21,8 @@ def have_my_actions_section(&block)
context 'logged in' do
let(:person) { double(pid: 'test:1234') }
- let(:name) { 'My Display Name' }
- let(:current_user) { User.new(name: name, person: person).tap {|u| u.stub(groups: ['registered'])} }
+ let(:name) { 'Display Name' }
+ let(:current_user) { User.new(first_name: 'Display', last_name: 'Name', person: person).tap {|u| u.stub(groups: ['registered'])} }
it 'renders a link to create a new user session' do
expect(rendered).to_not have_login_section
expect(rendered).to have_add_content_section do