Skip to content

Commit

Permalink
Convert degree name to match GPMS pattern when checking to see if fee…
Browse files Browse the repository at this point in the history
… is paid. Adds test for this (#812)
  • Loading branch information
ajkiessl authored Jul 29, 2024
1 parent c6df868 commit cae9c98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/services/fee_payment_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def author_psu_idn
end

def degree_name
submission.degree.name
# All caps and convert space to underscore to match GPMS pattern
submission.degree.name.upcase.gsub(' ', '_')
end

attr_accessor :submission
Expand Down
17 changes: 17 additions & 0 deletions spec/services/fee_payment_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@
expect(service.fee_is_paid?).to eq true
end
end

context "when the submission degree is M Ed" do
it 'returns true' do
submission.degree.name = 'M Ed'
submission.save!
stub_request(:get, "https://secure.gradsch.psu.edu/services/etd/etdPayment.cfm?degree=M_ED&psuid=#{submission.author.psu_idn}")
.with(
headers: {
'Accept' => '*/*',
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'User-Agent' => 'Ruby'
}
)
.to_return(status: 200, body: "\r\n {\"data\":[{\"ETDPAYMENTFOUND\":\"Y\"}],\"error\":\"\"}\r\n ", headers: {})
expect(service.fee_is_paid?).to eq true
end
end
end

context "when the student's fee has not been paid" do
Expand Down

0 comments on commit cae9c98

Please sign in to comment.