Skip to content

Commit

Permalink
Merge pull request #45 from Fullscreen/dont-error-for-where
Browse files Browse the repository at this point in the history
`Funky::Video.where(id: id)` should never error.
  • Loading branch information
claudiofullscreen committed Jun 17, 2016
2 parents d06cf9a + bf097fc commit e421f8f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,11 @@ For more information about changelogs, check
[Keep a Changelog](http://keepachangelog.com) and
[Vandamme](http://tech-angels.github.io/vandamme).

## 0.2.2 - 2016/06/17

* [BUGFIX] Single video id passed to the `Funky::Video.where` clause will not
error even if the response is not 200. It would return an empty array.

## 0.2.1 - 2016/06/16

* [FEATURE] Add method to find video by url, `Funky::Video.find_by_url!(url)`.
Expand Down
2 changes: 1 addition & 1 deletion lib/funky/version.rb
@@ -1,3 +1,3 @@
module Funky
VERSION = "0.2.1"
VERSION = "0.2.2"
end
2 changes: 2 additions & 0 deletions lib/funky/video.rb
Expand Up @@ -116,6 +116,8 @@ def self.fetch_and_parse_data(ids)
response = Connection::API.request(id: id, fields: fields)
end
parse response
rescue ContentNotFound
[]
end

def self.parse(response)
Expand Down
3 changes: 1 addition & 2 deletions spec/videos/video_spec.rb
Expand Up @@ -22,9 +22,8 @@

context 'given one unknown video ID was passed' do
let(:video_ids) {unknown_video_id}
let(:video) {videos.first}

it { expect{video.id}.to raise_error(Funky::ContentNotFound) }
it { expect(videos).to be_empty }
end

context 'given multiple existing video IDs were passed' do
Expand Down

0 comments on commit e421f8f

Please sign in to comment.