Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fee Payment handle spaces in degree name #812

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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