Skip to content
Snippets Groups Projects
Commit f8a7c53e authored by Gyan Gupta's avatar Gyan Gupta Committed by Anusha Ranganathan
Browse files

Fixed all test cases

parent c3e6182e
Branches
Tags
1 merge request!283Fixed all test cases
......@@ -17,16 +17,9 @@ RSpec.describe Hyrax::CrcDatasetForm do
expect(form.terms).to include(:coverage)
expect(form.terms).to include(:approval_number)
expect(form.terms).to include(:extra_information)
#expect(form.terms).to include(:complex_date)
#expect(form.terms).to include(:subject)
#expect(form.terms).to include(:publisher)
#expect(form.terms).to include(:language)
expect(form.terms).to include(:complex_funding_reference)
#expect(form.terms).to include(:description)
expect(form.terms).to include(:keyword)
#expect(form.terms).to include(:resource_type)
expect(form.terms).to include(:complex_relation)
#expect(form.terms).to include(:software_version)
end
it 'has the correct experiment primary terms' do
......@@ -38,18 +31,11 @@ RSpec.describe Hyrax::CrcDatasetForm do
expect(form.primary_terms).to include(:approval_number)
expect(form.primary_terms).to include(:extra_information)
expect(form.primary_terms).to include(:keyword)
expect(form.primary_terms).to include(:complex_funding_reference)
end
it 'has the correct experiment secondary terms' do
#expect(form.secondary_terms).to include(:complex_date)
#expect(form.secondary_terms).to include(:subject)
#expect(form.secondary_terms).to include(:publisher)
#expect(form.secondary_terms).to include(:language)
expect(form.secondary_terms).to include(:complex_funding_reference)
#expect(form.secondary_terms).to include(:description)
#expect(form.secondary_terms).to include(:resource_type)
expect(form.secondary_terms).to include(:complex_relation)
#expect(form.secondary_terms).to include(:software_version)
end
it 'excludes primary terms from secondary terms' do
......@@ -79,11 +65,8 @@ RSpec.describe Hyrax::CrcDatasetForm do
describe '#build_permitted_params' do
subject { described_class.build_permitted_params }
# it { is_expected.to include(:member_of_collection_ids, :find_child_work) }
context 'permitted params' do
it do
# expect(described_class).to receive(:permitted_date_params).at_least(:once).and_call_original
expect(described_class).to receive(:permitted_person_params).at_least(:once).and_call_original
expect(described_class).to receive(:permitted_relation_params).at_least(:once).and_call_original
expect(described_class).to receive(:permitted_fundref_params).at_least(:once).and_call_original
......
......@@ -17,19 +17,11 @@ RSpec.describe NestedPersonInput, type: :input do
let(:html) { input.send(:build_components, :complex_person, value, index, options) }
it 'generates the correct fields' do
is_expected.to have_field('dataset_complex_person_attributes_0_name', type: :text, with: 'Anamika')
is_expected.to have_select('dataset_complex_person_attributes_0_role', selected: 'operator')
is_expected.not_to have_select('dataset[complex_person_attributes][0]_complex_identifier_attributes_0_scheme', selected: 'Identifier - Local')
is_expected.not_to have_field('dataset[complex_person_attributes][0]_complex_identifier_attributes_0_identifier', type: :text, with: '123456')
#is_expected.to have_field('dataset[complex_person_attributes][0]_complex_affiliation_attributes_0_job_title', type: :text, with: 'Principal Investigator')
#is_expected.to have_field('dataset[complex_person_attributes][0][complex_affiliation_attributes][0]_complex_organization_attributes_0_organization', type: :text, with: 'University')
#is_expected.to have_field('dataset[complex_person_attributes][0][complex_affiliation_attributes][0]_complex_organization_attributes_0_sub_organization', type: :text, with: 'Department')
#is_expected.to have_field('dataset[complex_person_attributes][0][complex_affiliation_attributes][0]_complex_organization_attributes_0_purpose', type: :text, with: 'Research')
is_expected.to have_field('dataset_complex_person_attributes_0_orcid', type: :text)
# is_expected.to have_field('dataset_complex_person_attributes_0_organization', type: :text)
# is_expected.to have_field('dataset_complex_person_attributes_0_sub_organization', type: :text)
# FIXME
is_expected.not_to have_unchecked_field('dataset_complex_person_attributes_0_corresponding_author')
end
......
......@@ -8,11 +8,11 @@ RSpec.describe ComplexSession do
:with_coverage, :with_approval_number, :with_extra_information )
complex_subject = build(:complex_subject, :subject_title, :subject_species, :subject_type, parent_source_identifier: crc_dataset.source.first)
complex_subject = create(:complex_subject, :subject_title, :subject_species, :subject_type, parent_source_identifier: crc_dataset.source.first)
complex_session = complex_subject.complex_sessions.build(session_title: 'Demo session title')
complex_session = complex_subject.complex_sessions.create(session_title: 'Demo session title')
complex_modality = complex_session.complex_modalities.build(modality_title: 'Demo modality title')
complex_modality = complex_session.complex_modalities.create(modality_title: 'Demo modality title')
expect(complex_modality.modality_title).to eq('Demo modality title')
expect(complex_modality.complex_session.session_title).to eq(complex_session.session_title)
......
require 'rails_helper'
RSpec.describe ComplexSession do
before :all do
ActiveFedora::Cleaner.clean!
Hyrax::PermissionTemplateAccess.destroy_all
Hyrax::PermissionTemplate.destroy_all
end
it 'creates a complex subject with its attributes' do
admin_role = Role.find_by(name: "admin")
......
require 'rails_helper'
RSpec.describe ComplexSubject do
before do
ActiveFedora::Cleaner.clean!
end
it 'creates a complex subject with its attributes' do
admin_role = Role.find_by(name: "admin")
user = admin_role.users.first
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment