thetvdb_mapper 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +5 -14
- data/lib/thetvdb_mapper.rb +4 -10
- data/lib/thetvdb_mapper/actor.rb +7 -0
- data/lib/thetvdb_mapper/banner.rb +14 -0
- data/lib/thetvdb_mapper/base.rb +3 -9
- data/lib/thetvdb_mapper/episode.rb +32 -11
- data/lib/thetvdb_mapper/series.rb +25 -11
- data/lib/thetvdb_mapper/version.rb +1 -1
- data/spec/functionals/actor_spec.rb +34 -0
- data/spec/functionals/banner_spec.rb +49 -0
- data/spec/functionals/episode_spec.rb +88 -0
- data/spec/functionals/series_spec.rb +72 -0
- data/thetvdb_mapper.gemspec +2 -1
- metadata +29 -65
- data/lib/thetvdb_mapper/actors.rb +0 -17
- data/lib/thetvdb_mapper/banners.rb +0 -17
- data/lib/thetvdb_mapper/fetcher.rb +0 -25
- data/lib/thetvdb_mapper/full_series.rb +0 -53
- data/lib/thetvdb_mapper/mapping/actor.rb +0 -11
- data/lib/thetvdb_mapper/mapping/banner.rb +0 -18
- data/lib/thetvdb_mapper/mapping/base.rb +0 -27
- data/lib/thetvdb_mapper/mapping/episode.rb +0 -45
- data/lib/thetvdb_mapper/mapping/series.rb +0 -36
- data/lib/thetvdb_mapper/mapping/string_list.rb +0 -5
- data/spec/functionals/mapping/actor_spec.rb +0 -36
- data/spec/functionals/mapping/banner_spec.rb +0 -72
- data/spec/functionals/mapping/episode_spec.rb +0 -165
- data/spec/functionals/mapping/series_spec.rb +0 -128
- data/spec/integrations/classes/actors_spec.rb +0 -11
- data/spec/integrations/classes/banners_spec.rb +0 -11
- data/spec/integrations/classes/episode_spec.rb +0 -11
- data/spec/integrations/classes/fetcher_spec.rb +0 -35
- data/spec/integrations/classes/full_series_spec.rb +0 -11
- data/spec/integrations/classes/series_spec.rb +0 -11
- data/spec/integrations/integration_spec_helper.rb +0 -2
- data/spec/integrations/support/.keep +0 -0
- data/spec/units/actors_spec.rb +0 -40
- data/spec/units/banners_spec.rb +0 -40
- data/spec/units/base_spec.rb +0 -15
- data/spec/units/episode_spec.rb +0 -33
- data/spec/units/fetcher_spec.rb +0 -67
- data/spec/units/full_series_spec.rb +0 -140
- data/spec/units/mapping/actor_spec.rb +0 -27
- data/spec/units/mapping/banner_spec.rb +0 -54
- data/spec/units/mapping/base_spec.rb +0 -36
- data/spec/units/mapping/episode_spec.rb +0 -142
- data/spec/units/mapping/series_spec.rb +0 -114
- data/spec/units/mapping/string_list_spec.rb +0 -11
- data/spec/units/series_spec.rb +0 -33
@@ -1,36 +0,0 @@
|
|
1
|
-
class MappingExample < ThetvdbMapper::Mapping::Base
|
2
|
-
end
|
3
|
-
|
4
|
-
describe ThetvdbMapper::Mapping::Banner do
|
5
|
-
let(:model) { MappingExample.new(sample: 'test') }
|
6
|
-
|
7
|
-
describe '.map' do
|
8
|
-
before do
|
9
|
-
model.stub(:rules).and_return(sample: :example)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should convert hash' do
|
13
|
-
model.map.should == { example: 'test' }
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should call convert method if exists' do
|
17
|
-
model.should_receive(:convert).and_return(sample: true)
|
18
|
-
model.map
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '.convert_to_list' do
|
23
|
-
it 'should return correct hash' do
|
24
|
-
model.stub(:list_mapping_object).with('test').and_return(double(map: true))
|
25
|
-
model.list_mapping_object('test').should_receive(:map)
|
26
|
-
model.convert_to_list('test')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '.list_mapping_object' do
|
31
|
-
it 'should return mapping instance' do
|
32
|
-
ThetvdbMapper::Mapping::StringList.should_receive(:new)
|
33
|
-
model.list_mapping_object('test')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Mapping::Episode do
|
4
|
-
let(:model) { ThetvdbMapper::Mapping::Episode.new({}) }
|
5
|
-
|
6
|
-
describe '#map' do
|
7
|
-
it 'should map id' do
|
8
|
-
model.rules['id'].should == :id
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should map Combined_episodenumber' do
|
12
|
-
model.rules['Combined_episodenumber'].should == :combined_episode_number
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should map Combined_season' do
|
16
|
-
model.rules['Combined_season'].should == :combined_season
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should map DVD_episodenumber' do
|
20
|
-
model.rules['DVD_episodenumber'].should == :dvd_episode_number
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should map DVD_season' do
|
24
|
-
model.rules['DVD_season'].should == :dvd_season
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should map Director' do
|
28
|
-
model.rules['Director'].should == :director
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should map EpImgFlag' do
|
32
|
-
model.rules['EpImgFlag'].should == :ep_img_flag
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should map EpisodeName' do
|
36
|
-
model.rules['EpisodeName'].should == :name
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should map EpisodeNumber' do
|
40
|
-
model.rules['EpisodeNumber'].should == :number
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should map FirstAired' do
|
44
|
-
model.rules['FirstAired'].should == :first_aired
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should map GuestStars' do
|
48
|
-
model.rules['GuestStars'].should == :guest_stars
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should map IMDB_ID' do
|
52
|
-
model.rules['IMDB_ID'].should == :imdb_id
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should map Language' do
|
56
|
-
model.rules['Language'].should == :language
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should map Overview' do
|
60
|
-
model.rules['Overview'].should == :overview
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should map ProductionCode' do
|
64
|
-
model.rules['ProductionCode'].should == :production_code
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'should map Rating' do
|
68
|
-
model.rules['Rating'].should == :rating
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'should map RatingCount' do
|
72
|
-
model.rules['RatingCount'].should == :rating_count
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should map SeasonNumber' do
|
76
|
-
model.rules['SeasonNumber'].should == :season
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'should map Writer' do
|
80
|
-
model.rules['Writer'].should == :writer
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'should map absolute_number' do
|
84
|
-
model.rules['absolute_number'].should == :absolute_number
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'should map airsafter_season' do
|
88
|
-
model.rules['airsafter_season'].should == :airs_after_season
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should map airsbefore_episode' do
|
92
|
-
model.rules['airsbefore_episode'].should == :airs_before_episode
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should map airsbefore_season' do
|
96
|
-
model.rules['airsbefore_season'].should == :airs_before_season
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should map filename' do
|
100
|
-
model.rules['filename'].should == :filename_path
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'should map lastupdated' do
|
104
|
-
model.rules['lastupdated'].should == :last_updated_at
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'should map seasonid' do
|
108
|
-
model.rules['seasonid'].should == :season_id
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'should map seriesid' do
|
112
|
-
model.rules['seriesid'].should == :series_id
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'should map thumb_added' do
|
116
|
-
model.rules['thumb_added'].should == :thumbnail_added_at
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'should map thumb_height' do
|
120
|
-
model.rules['thumb_height'].should == :thumbnail_height
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'should map thumb_width' do
|
124
|
-
model.rules['thumb_width'].should == :thumbnail_width
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe '#convert' do
|
129
|
-
let(:input) { { director: true, guest_stars: true, writer: true, last_updated_at: 1} }
|
130
|
-
let(:output) { { director: 'LIST', guest_stars: 'LIST', writer: 'LIST', last_updated_at: 'TIME'} }
|
131
|
-
let(:model) { ThetvdbMapper::Mapping::Episode.new(input) }
|
132
|
-
|
133
|
-
before do
|
134
|
-
model.stub(:convert_to_list).and_return('LIST')
|
135
|
-
Time.stub(:at).and_return('TIME')
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'should return correct hash' do
|
139
|
-
model.convert.should == output
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
@@ -1,114 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Mapping::Series do
|
4
|
-
let(:model) { ThetvdbMapper::Mapping::Series.new({}) }
|
5
|
-
|
6
|
-
describe '#rules' do
|
7
|
-
it 'should map id' do
|
8
|
-
model.rules['id'].should == :id
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should map Airs_DayOfWeek' do
|
12
|
-
model.rules['Airs_DayOfWeek'].should == :airs_day_of_week
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should map Airs_Time' do
|
16
|
-
model.rules['Airs_Time'].should == :airs_time
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should map ContentRating' do
|
20
|
-
model.rules['ContentRating'].should == :content_rating
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should map FirstAired' do
|
24
|
-
model.rules['FirstAired'].should == :first_aired
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should map Genre' do
|
28
|
-
model.rules['Genre'].should == :genres
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should map IMDB_ID' do
|
32
|
-
model.rules['IMDB_ID'].should == :imdb_id
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should map Language' do
|
36
|
-
model.rules['Language'].should == :language
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should map Network' do
|
40
|
-
model.rules['Network'].should == :network
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should map NetworkID' do
|
44
|
-
model.rules['NetworkID'].should == :network_id
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should map Overview' do
|
48
|
-
model.rules['Overview'].should == :overview
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should map Rating' do
|
52
|
-
model.rules['Rating'].should == :rating
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should map RatingCount' do
|
56
|
-
model.rules['RatingCount'].should == :rating_count
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should map Runtime' do
|
60
|
-
model.rules['Runtime'].should == :runtime
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should map SeriesName' do
|
64
|
-
model.rules['SeriesName'].should == :name
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'should map Status' do
|
68
|
-
model.rules['Status'].should == :status
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'should map added' do
|
72
|
-
model.rules['added'].should == :added_at
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should map addedBy' do
|
76
|
-
model.rules['addedBy'].should == :added_by
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'should map banner' do
|
80
|
-
model.rules['banner'].should == :banner_path
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'should map fanart' do
|
84
|
-
model.rules['fanart'].should == :fanart_path
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'should map lastupdated' do
|
88
|
-
model.rules['lastupdated'].should == :last_updated_at
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should map poster' do
|
92
|
-
model.rules['poster'].should == :poster_path
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should map zap2it_id' do
|
96
|
-
model.rules['zap2it_id'].should == :zap2it_id
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe '#convert' do
|
101
|
-
let(:input) { { genres: true, last_updated_at: 1} }
|
102
|
-
let(:output) { { genres: 'LIST', last_updated_at: 'TIME'} }
|
103
|
-
let(:model) { ThetvdbMapper::Mapping::Series.new(input) }
|
104
|
-
|
105
|
-
before do
|
106
|
-
model.stub(:convert_to_list).and_return('LIST')
|
107
|
-
Time.stub(:at).and_return('TIME')
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'should return correct hash' do
|
111
|
-
model.convert.should == output
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
data/spec/units/series_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Series do
|
4
|
-
let(:model) { ThetvdbMapper::Series.new(1) }
|
5
|
-
|
6
|
-
describe '.data' do
|
7
|
-
before do
|
8
|
-
model.stub_chain(:fetcher, :series, :body).and_return(sample: true)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should call map on mapping class' do
|
12
|
-
model.stub(:mapping_object).and_return(double(map: true))
|
13
|
-
model.mapping_object(sample: true).should_receive(:map)
|
14
|
-
model.data
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '.inspect' do
|
19
|
-
before do
|
20
|
-
model.stub(:data).and_return('DATA')
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should return correct string' do
|
24
|
-
model.inspect.should == '<ThetvdbMapper::Series data=DATA >'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '.mapping_object' do
|
29
|
-
it 'should return mapping episode instance' do
|
30
|
-
model.mapping_object(sample: true).class.should == ThetvdbMapper::Mapping::Series
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|