Skip to content

Commit

Permalink
760 - updates integration test
Browse files Browse the repository at this point in the history
Now updates an integration test to ensure that the acknowledgment page appears for the grad program.
  • Loading branch information
jlandiseigsti committed Jun 10, 2024
1 parent 1c63097 commit bf0bdb0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ You're good to go from here! Any changes made in the project files on your loca

To run the tests:
1. `RAILS_ENV=test bundle exec rspec` tests Graduate School instance
2. `RAILS_ENV=test bundle exec PARTNER=honors rspec` tests Honors College instance
2. `RAILS_ENV=test PARTNER=honors bundle exec rspec` tests Honors College instance
3. `RAILS_ENV=test PARTNER=milsch bundle exec rspec` tests Millennium Scholars instance

Running the entire test suite for each partner can take a while. To run tests for non-graduate instances that are unique to that instance, use tags like this:
Expand Down
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_05_29_142659) do
ActiveRecord::Schema.define(version: 2024_06_04_152657) do

create_table "admins", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.string "access_id", default: "", null: false
Expand Down Expand Up @@ -176,7 +176,7 @@
t.index ["name"], name: "index_degrees_on_name", unique: true
end

create_table "faculty_members", charset: "utf8mb4", force: :cascade do |t|
create_table "faculty_members", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.string "first_name", null: false
t.string "middle_name"
t.string "last_name", null: false
Expand Down Expand Up @@ -294,6 +294,7 @@
t.string "academic_program"
t.string "degree_checkout_status"
t.datetime "acknowledgment_page_viewed_at"
t.datetime "author_release_warning_sent_at"
t.index ["author_id"], name: "submissions_author_id_fk"
t.index ["degree_id"], name: "submissions_degree_id_fk"
t.index ["final_submission_legacy_id"], name: "index_submissions_on_final_submission_legacy_id"
Expand Down
4 changes: 0 additions & 4 deletions spec/factories/submissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@
final_submission_traits
end

trait :acknowledge_page_not_viewed do
acknowledgment_page_viewed_at { nil }
end

after(:create) do |submission|
create_list(:keyword, 2, submission:)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,40 @@
find_button("Save Thesis or Dissertation Title").click if current_partner.graduate?
find_button('Save Program Information').click unless current_partner.graduate?
new_submission = Submission.where(title: 'A unique test title').first
new_submission = author.submissions.first
expect(new_submission.status).to eq 'collecting committee'
expect(new_submission.program.id).to eq(Program.where(name: 'Information Sciences and Technology').first.id)
if current_partner.honors?
visit "/author/submissions/#{new_submission.id}/edit"
select second_program.name, from: current_partner.program_label.to_s
second_program_id = Program.where(name: second_program.name).first.id
click_on "Update Program Information"
submission = author.submissions.first.reload
expect(submission.program.id).to eq(second_program_id)
end
end
end

describe "when I sign the acknowledgment page" do
before do
oidc_authorize_author
end

let(:author) { current_author }

it "page progresses to edit page'" do
skip 'graduate only' unless current_partner.graduate?
program = FactoryBot.create :program, name: 'Information Sciences and Technology'
second_program = FactoryBot.create :program, name: 'A different program'
new_submission = FactoryBot.create(:submission, :collecting_committee, author:, acknowledgment_page_viewed_at: nil)
visit "/author/submissions/#{new_submission.id}/edit"
expect(page).to have_content('I acknowledge that')
fields = all('input[type="text"]')
fields.each do |field|
field.set('JLE')
end
find_button('Submit').click
expect(page).to have_content("Update #{new_submission.degree_type} Title")
select second_program.name, from: current_partner.program_label.to_s
second_program_id = Program.where(name: second_program.name).first.id
click_on "Update #{new_submission.degree_type} Title" if current_partner.graduate?
Expand Down

0 comments on commit bf0bdb0

Please sign in to comment.