thetvdb_mapper 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
File without changes
|
data/spec/units/actors_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Actors do
|
4
|
-
let(:model) { ThetvdbMapper::Actors.new(1) }
|
5
|
-
|
6
|
-
describe '.data' do
|
7
|
-
before do
|
8
|
-
model.stub_chain(:fetcher, :actors, :body).and_return([{}])
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should call map' do
|
12
|
-
model.should_receive(:map)
|
13
|
-
model.data
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '.map' do
|
18
|
-
it 'should call map on mapping class' do
|
19
|
-
model.stub(:mapping_object).with(sample: true).and_return(double(map: true))
|
20
|
-
model.mapping_object(sample: true).should_receive(:map)
|
21
|
-
model.map(sample: true)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '.inspect' do
|
26
|
-
before do
|
27
|
-
model.stub(:data).and_return('DATA')
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should return correct string' do
|
31
|
-
model.inspect.should == '<ThetvdbMapper::Actors data=DATA >'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '.mapping_object' do
|
36
|
-
it 'should return mapping actor instance' do
|
37
|
-
model.mapping_object(sample: true).class.should == ThetvdbMapper::Mapping::Actor
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/spec/units/banners_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Banners do
|
4
|
-
let(:model) { ThetvdbMapper::Banners.new(1) }
|
5
|
-
|
6
|
-
describe '.data' do
|
7
|
-
before do
|
8
|
-
model.stub_chain(:fetcher, :banners, :body).and_return([{}])
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should call map' do
|
12
|
-
model.should_receive(:map)
|
13
|
-
model.data
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '.map' do
|
18
|
-
it 'should call map on mapping class' do
|
19
|
-
model.stub(:mapping_object).with(sample: true).and_return(double(map: true))
|
20
|
-
model.mapping_object(sample: true).should_receive(:map)
|
21
|
-
model.map(sample: true)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '.inspect' do
|
26
|
-
before do
|
27
|
-
model.stub(:data).and_return('DATA')
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should return correct string' do
|
31
|
-
model.inspect.should == '<ThetvdbMapper::Banners data=DATA >'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '.mapping_object' do
|
36
|
-
it 'should return mapping banner instance' do
|
37
|
-
model.mapping_object(sample: true).class.should == ThetvdbMapper::Mapping::Banner
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/spec/units/base_spec.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class ExampleClass < ThetvdbMapper::Base
|
4
|
-
end
|
5
|
-
|
6
|
-
describe ThetvdbMapper::Base do
|
7
|
-
let(:model) { ExampleClass.new(1) }
|
8
|
-
|
9
|
-
describe '.fetcher' do
|
10
|
-
it 'should call map' do
|
11
|
-
ThetvdbMapper::Fetcher.should_receive(:new)
|
12
|
-
model.fetcher
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/spec/units/episode_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Episode do
|
4
|
-
let(:model) { ThetvdbMapper::Episode.new(1) }
|
5
|
-
|
6
|
-
describe '.data' do
|
7
|
-
before do
|
8
|
-
model.stub_chain(:fetcher, :episode, :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::Episode 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::Episode
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/spec/units/fetcher_spec.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Fetcher do
|
4
|
-
let(:model) { ThetvdbMapper::Fetcher.new }
|
5
|
-
|
6
|
-
describe '.series' do
|
7
|
-
before do
|
8
|
-
model.stub_chain(:client, :series).and_return(double(find: true))
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should call series find' do
|
12
|
-
model.client.series.should_receive(:find).with(1, mapping: true)
|
13
|
-
model.series(1)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '.full_series' do
|
18
|
-
before do
|
19
|
-
model.stub_chain(:client, :series).and_return(double(find_full: true))
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should call series find_full' do
|
23
|
-
model.client.series.should_receive(:find_full).with(1, mapping: true)
|
24
|
-
model.full_series(1)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '.actors' do
|
29
|
-
before do
|
30
|
-
model.stub_chain(:client, :actor).and_return(double(find: true))
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should call actor all' do
|
34
|
-
model.client.actor.should_receive(:find).with(1, mapping: true)
|
35
|
-
model.actors(1)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '.banners' do
|
40
|
-
before do
|
41
|
-
model.stub_chain(:client, :banner).and_return(double(find: true))
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should call banner all' do
|
45
|
-
model.client.banner.should_receive(:find).with(1, mapping: true)
|
46
|
-
model.banners(1)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '.episode' do
|
51
|
-
before do
|
52
|
-
model.stub_chain(:client, :episode).and_return(double(find: true))
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should call episode find_by_default_order' do
|
56
|
-
model.client.episode.should_receive(:find).with(1, mapping: true)
|
57
|
-
model.episode(1)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe '.client' do
|
62
|
-
it 'should create ThetvdbApi::Client instance' do
|
63
|
-
ThetvdbApi::Client.should_receive(:new)
|
64
|
-
model.client
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,140 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::FullSeries do
|
4
|
-
let(:model) { ThetvdbMapper::FullSeries.new(1) }
|
5
|
-
|
6
|
-
describe '.data' do
|
7
|
-
before do
|
8
|
-
model.stub(:series).and_return({})
|
9
|
-
model.stub(:episodes).and_return([])
|
10
|
-
model.stub(:actors).and_return([])
|
11
|
-
model.stub(:banners).and_return([])
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should call series' do
|
15
|
-
model.stub(:series).and_return(sample: true)
|
16
|
-
model.data[:sample].should be_true
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should store episodes in data hash' do
|
20
|
-
model.stub(:episodes).and_return([{ sample: true }])
|
21
|
-
model.data[:episodes].should == [{ sample: true }]
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should store actors in data hash' do
|
25
|
-
model.stub(:actors).and_return([{ sample: true }])
|
26
|
-
model.data[:actors].should == [{ sample: true }]
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should store banners in data hash' do
|
30
|
-
model.stub(:banners).and_return([{ sample: true }])
|
31
|
-
model.data[:banners].should == [{ sample: true }]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '.series' do
|
36
|
-
before do
|
37
|
-
model.stub_chain(:fetcher, :full_series, :body).and_return({ 'Series' => { sample: true } })
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should map series' do
|
41
|
-
model.stub(:mapping_series_object).and_return(double(map: true))
|
42
|
-
model.mapping_series_object(sample: true).should_receive(:map)
|
43
|
-
model.series
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '.episodes' do
|
48
|
-
before do
|
49
|
-
model.stub_chain(:fetcher, :full_series, :body).and_return({ 'Episode' => [{ sample: true }] })
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should map episode' do
|
53
|
-
model.should_receive(:map_episode).with(sample: true)
|
54
|
-
model.episodes
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '.map_episode' do
|
59
|
-
it 'should map episode' do
|
60
|
-
model.stub(:mapping_episode_object).and_return(double(map: true))
|
61
|
-
model.mapping_episode_object(sample: true).should_receive(:map)
|
62
|
-
model.map_episode(sample: true)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '.actors' do
|
67
|
-
before do
|
68
|
-
model.stub_chain(:fetcher, :actors, :body).and_return([{ sample: true }])
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'should map actor' do
|
72
|
-
model.should_receive(:map_actor).with(sample: true)
|
73
|
-
model.actors
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '.map_actor' do
|
78
|
-
it 'should map actor' do
|
79
|
-
model.stub(:mapping_actor_object).and_return(double(map: true))
|
80
|
-
model.mapping_actor_object(sample: true).should_receive(:map)
|
81
|
-
model.map_actor(sample: true)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe '.banners' do
|
86
|
-
before do
|
87
|
-
model.stub_chain(:fetcher, :banners, :body).and_return([{ sample: true }])
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'should map banner' do
|
91
|
-
model.should_receive(:map_banner).with(sample: true)
|
92
|
-
model.banners
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '.map_banner' do
|
97
|
-
before do
|
98
|
-
model.stub(:mapping_banner_object).with(sample: true).and_return(double(map: true))
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'should map banner' do
|
102
|
-
model.mapping_banner_object(sample: true).should_receive(:map)
|
103
|
-
model.map_banner(sample: true)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe '.mapping_series_object' do
|
108
|
-
it 'should return mapping series instance' do
|
109
|
-
model.mapping_series_object(sample: true).class.should == ThetvdbMapper::Mapping::Series
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe '.mapping_episode_object' do
|
114
|
-
it 'should return mapping episode instance' do
|
115
|
-
model.mapping_episode_object(sample: true).class.should == ThetvdbMapper::Mapping::Episode
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe '.mapping_actor_object' do
|
120
|
-
it 'should return mapping actor instance' do
|
121
|
-
model.mapping_actor_object(sample: true).class.should == ThetvdbMapper::Mapping::Actor
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe '.mapping_banner_object' do
|
126
|
-
it 'should return mapping banner instance' do
|
127
|
-
model.mapping_banner_object(sample: true).class.should == ThetvdbMapper::Mapping::Banner
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe '.inspect' do
|
132
|
-
before do
|
133
|
-
model.stub(:data).and_return('DATA')
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'should return correct string' do
|
137
|
-
model.inspect.should == '<ThetvdbMapper::FullSeries data=DATA >'
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Mapping::Actor do
|
4
|
-
let(:model) { ThetvdbMapper::Mapping::Actor.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 Image' do
|
12
|
-
model.rules['Image'].should == :image_path
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should map Name' do
|
16
|
-
model.rules['Name'].should == :name
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should map Role' do
|
20
|
-
model.rules['Role'].should == :role
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should map SortOrder' do
|
24
|
-
model.rules['SortOrder'].should == :sort_order
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ThetvdbMapper::Mapping::Banner do
|
4
|
-
let(:model) { ThetvdbMapper::Mapping::Banner.new({}) }
|
5
|
-
|
6
|
-
describe '#rules' do
|
7
|
-
it 'should map id' do
|
8
|
-
model.rules['id'].should == :id
|
9
|
-
end
|
10
|
-
it 'should map BannerPath' do
|
11
|
-
model.rules['BannerPath'].should == :path
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should map ThumbnailPath' do
|
15
|
-
model.rules['ThumbnailPath'].should == :thumbnail_path
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should map VignettePath' do
|
19
|
-
model.rules['VignettePath'].should == :vignette_path
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should map BannerType' do
|
23
|
-
model.rules['BannerType'].should == :kind
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should map BannerType2' do
|
27
|
-
model.rules['BannerType2'].should == :kind2
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should map Language' do
|
31
|
-
model.rules['Language'].should == :language
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should map Season' do
|
35
|
-
model.rules['Season'].should == :season
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should map Rating' do
|
39
|
-
model.rules['Rating'].should == :rating
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should map RatingCount' do
|
43
|
-
model.rules['RatingCount'].should == :rating_count
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should map SeriesName' do
|
47
|
-
model.rules['SeriesName'].should == :series_name
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should map Colors' do
|
51
|
-
model.rules['Colors'].should == :colors
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|