Skip to content

Commit

Permalink
Just easier to read
Browse files Browse the repository at this point in the history
Closes #18
  • Loading branch information
pikesley committed Mar 4, 2015
1 parent da9e788 commit 5a6191c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 42 deletions.
44 changes: 24 additions & 20 deletions spec/services/flickr_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,36 @@ module Services
end

it 'distills data for a regular photo', :vcr do
expect(@f.distill 'https://www.flickr.com/photos/rawfunkmaharishi/15631479625/').to eq({
"title"=>"The Comedy, October 2014",
"date"=>"2014-10-22",
"photo_page"=>"https://www.flickr.com/photos/rawfunkmaharishi/15631479625/",
"photo_url"=>"https://farm4.staticflickr.com/3933/15631479625_b6168ee903_m.jpg",
"license"=>"Attribution-NonCommercial-ShareAlike",
"license_url"=>"https://creativecommons.org/licenses/by-nc-sa/2.0/",
"photographer"=>"kim"
})
dist = @f.distill 'https://www.flickr.com/photos/rawfunkmaharishi/15631479625/'
expect(dist.to_yaml).to eq(
"---
title: The Comedy, October 2014
date: '2014-10-22'
photo_page: https://www.flickr.com/photos/rawfunkmaharishi/15631479625/
photo_url: https://farm4.staticflickr.com/3933/15631479625_b6168ee903_m.jpg
license: Attribution-NonCommercial-ShareAlike
license_url: https://creativecommons.org/licenses/by-nc-sa/2.0/
photographer: kim
"
)
end

it 'ingests data for a photo without a specific photographer tag', :vcr do
@f.ingest 'https://www.flickr.com/photos/cluttercup/15950875724/'
expect(@f[0]).to eq ({
"title"=>"Raw Funk Maharishi",
"date"=>"2015-02-18",
"photo_page"=>"https://www.flickr.com/photos/cluttercup/15950875724/",
"photo_url"=>"https://farm8.staticflickr.com/7398/15950875724_23d58be214_m.jpg",
"license"=>"Attribution-NonCommercial",
"license_url"=>"https://creativecommons.org/licenses/by-nc/2.0/",
"photographer"=>"jane"
})
expect(@f[0].to_yaml).to eq (
"---
title: Raw Funk Maharishi
date: '2015-02-18'
photo_page: https://www.flickr.com/photos/cluttercup/15950875724/
photo_url: https://farm8.staticflickr.com/7398/15950875724_23d58be214_m.jpg
license: Attribution-NonCommercial
license_url: https://creativecommons.org/licenses/by-nc/2.0/
photographer: jane
"
)
end

it 'falls back to the default photographer name', :vcr do
expect(@f.distill('https://www.flickr.com/photos/pikesley/16649739916/')['photographer']).to eq 'pikesley'
it 'falls back to the default photographer name', :vcr do expect(@f.distill('https://www.flickr.com/photos/pikesley/16649739916/')['photographer']).to eq 'pikesley'
end
end
end
Expand Down
37 changes: 21 additions & 16 deletions spec/services/soundcloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,31 @@ module Services
end

it 'distills the data', :vcr do
distilld = @sc.distill 'https://soundcloud.com/rawfunkmaharishi/hexaflexagon-1'
expect(distilld).to eq({
"title"=>"Hexaflexagon",
"id"=>193008299,
"location"=>"Islington Academy",
"date"=>"2015-02-18",
"license"=>"Attribution-NonCommercial-ShareAlike",
"license_url"=>"http://creativecommons.org/licenses/by-nc-sa/4.0/"})
distilled = @sc.distill 'https://soundcloud.com/rawfunkmaharishi/hexaflexagon-1'
expect(distilled.to_yaml).to eq(
"---
title: Hexaflexagon
id: 193008299
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
license_url: http://creativecommons.org/licenses/by-nc-sa/4.0/
"
)
end

it 'ingests a track', :vcr do
@sc.ingest 'https://soundcloud.com/rawfunkmaharishi/bernard'
expect(@sc[0]).to eq({
"title"=>"Bernard",
"id"=>192841052,
"location"=>"Islington Academy",
"date"=>"2015-02-18",
"license"=>"Attribution-NonCommercial-ShareAlike",
"license_url"=>"http://creativecommons.org/licenses/by-nc-sa/4.0/"
})
expect(@sc[0].to_yaml).to eq(
"---
title: Bernard
id: 192841052
location: Islington Academy
date: '2015-02-18'
license: Attribution-NonCommercial-ShareAlike
license_url: http://creativecommons.org/licenses/by-nc-sa/4.0/
"
)
end
end
end
Expand Down
14 changes: 8 additions & 6 deletions spec/services/vimeo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ module Services

it 'ingests a video', :vcr do
@v.ingest 'https://vimeo.com/117102891'
expect(@v[0]).to eq({
"title"=>"Bernard",
"id"=>117102891,
"license"=>"Attribution-NonCommercial-ShareAlike",
"license_url"=>"http://creativecommons.org/licenses/by-nc-sa/3.0/"
})
expect(@v[0].to_yaml).to eq(
"---
title: Bernard
id: 117102891
license: Attribution-NonCommercial-ShareAlike
license_url: http://creativecommons.org/licenses/by-nc-sa/3.0/
"
)
end
end
end
Expand Down

0 comments on commit 5a6191c

Please sign in to comment.