Skip to content

Commit

Permalink
fix travis
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Mar 8, 2015
1 parent 8821c5f commit 387d53b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/adapters/plex/category_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@

describe "#children" do

before(:each) do
if ENV['CI']
stub_subtitles("/Users/mconway/Movies/TivoHMOTest/Movies/3 Idiots (2009).avi")
stub_subtitles("/Users/mconway/Movies/TivoHMOTest/Movies/Wyrmwood (2014).avi", language_code: nil)
stub_subtitles("/Users/mconway/Movies/TivoHMOTest/Movies/Rurouni Kenshin Kyoto Inferno (2014).mkv", language_code: nil)
end
end

it "should memoize" do
section = described_class.new(plex_delegate, :newest)
expect(section.children.object_id).to eq(section.children.object_id)
Expand Down
19 changes: 19 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,23 @@ def plex_movie_section

def plex_tv_section
plex_server.library.sections.find {|s| s.type == 'show' && s.title == 'Test TV Shows'}
end

def stub_subtitles(media_path, language_code: 'en', type: :file, format: 'srt')
require 'iso-639'

allow(TivoHMO::SubtitlesUtil.instance).to receive(:subtitles_for_media_file).with(media_path) do |path|
subs = []
if language_code
st = TivoHMO::API::Subtitle.new
st.type = type
st.format = format
st.language_code = language_code
st.language = ISO_639.find_by_code(language_code.downcase).english_name
st.location = "#{path.chomp(File.extname(path))}.en.srt"
subs << st
end
subs
end

end

0 comments on commit 387d53b

Please sign in to comment.