Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
The method signature changed, so I updated the tests.
however: should it change? is there a better way to deal with this?
  • Loading branch information
vasconsaurus committed Feb 19, 2025
1 parent 775522f commit fa41a0e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/models/media_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def setup

test "Claim Media: should save the original_claim and original_claim_hash when created from original claim" do
claim = 'This is a claim.'
claim_media = Media.find_or_create_claim_media(claim)
claim_media = Media.find_or_create_claim_media(claim, nil, true)

assert_not_nil claim_media.original_claim_hash
assert_not_nil claim_media.original_claim
Expand All @@ -645,7 +645,7 @@ def setup

test "Claim Media: should not create duplicate media if media with original_claim_hash exists" do
assert_difference 'Claim.count', 1 do
2.times { Media.find_or_create_claim_media('This is a claim.') }
2.times { Media.find_or_create_claim_media('This is a claim.', nil, true) }
end
end

Expand All @@ -664,7 +664,7 @@ def setup
}.to_json
WebMock.stub_request(:get, pender_url).with(query: { url: link_url }).to_return(body: link_response)

link_media = Media.find_or_create_link_media(link_url, team)
link_media = Media.find_or_create_link_media(link_url, team, true)

assert_not_nil link_media.original_claim_hash
assert_not_nil link_media.original_claim
Expand Down Expand Up @@ -715,10 +715,9 @@ def setup
file.write(File.read(File.join(Rails.root, 'test', 'data', 'rails.mp3')))
file.rewind
audio_url = "http://example.com/#{file.path.split('/').last}"
ext = File.extname(URI.parse(audio_url).path)
WebMock.stub_request(:get, audio_url).to_return(body: file.read, headers: { 'Content-Type' => 'audio/mp3' })

uploaded_media = Media.find_or_create_uploaded_file_media('UploadedAudio', audio_url, ext)
uploaded_media = Media.find_or_create_uploaded_file_media(audio_url, 'UploadedAudio', true)

assert_not_nil uploaded_media.original_claim_hash
assert_not_nil uploaded_media.original_claim
Expand All @@ -738,11 +737,10 @@ def setup
file.write(File.read(File.join(Rails.root, 'test', 'data', 'rails.mp3')))
file.rewind
audio_url = "http://example.com/#{file.path.split('/').last}"
ext = File.extname(URI.parse(audio_url).path)
WebMock.stub_request(:get, audio_url).to_return(body: file.read, headers: { 'Content-Type' => 'audio/mp3' })

assert_difference 'UploadedAudio.count', 1 do
2.times { Media.find_or_create_uploaded_file_media('UploadedAudio', audio_url, ext) }
2.times { Media.find_or_create_uploaded_file_media(audio_url, 'UploadedAudio', true) }
end
end
end
Expand Down

0 comments on commit fa41a0e

Please sign in to comment.