thetvdb_mapper 0.0.2 → 0.0.3

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.
@@ -1,141 +1,142 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ThetvdbMapper::Mapping::Episode do
4
- let(:klass) { ThetvdbMapper::Mapping::Episode }
4
+ let(:model) { ThetvdbMapper::Mapping::Episode.new({}) }
5
5
 
6
6
  describe '#map' do
7
7
  it 'should map id' do
8
- klass.rules['id'].should == :id
8
+ model.rules['id'].should == :id
9
9
  end
10
10
 
11
11
  it 'should map Combined_episodenumber' do
12
- klass.rules['Combined_episodenumber'].should == :combined_episode_number
12
+ model.rules['Combined_episodenumber'].should == :combined_episode_number
13
13
  end
14
14
 
15
15
  it 'should map Combined_season' do
16
- klass.rules['Combined_season'].should == :combined_season
16
+ model.rules['Combined_season'].should == :combined_season
17
17
  end
18
18
 
19
19
  it 'should map DVD_episodenumber' do
20
- klass.rules['DVD_episodenumber'].should == :dvd_episode_number
20
+ model.rules['DVD_episodenumber'].should == :dvd_episode_number
21
21
  end
22
22
 
23
23
  it 'should map DVD_season' do
24
- klass.rules['DVD_season'].should == :dvd_season
24
+ model.rules['DVD_season'].should == :dvd_season
25
25
  end
26
26
 
27
27
  it 'should map Director' do
28
- klass.rules['Director'].should == :director
28
+ model.rules['Director'].should == :director
29
29
  end
30
30
 
31
31
  it 'should map EpImgFlag' do
32
- klass.rules['EpImgFlag'].should == :ep_img_flag
32
+ model.rules['EpImgFlag'].should == :ep_img_flag
33
33
  end
34
34
 
35
35
  it 'should map EpisodeName' do
36
- klass.rules['EpisodeName'].should == :name
36
+ model.rules['EpisodeName'].should == :name
37
37
  end
38
38
 
39
39
  it 'should map EpisodeNumber' do
40
- klass.rules['EpisodeNumber'].should == :number
40
+ model.rules['EpisodeNumber'].should == :number
41
41
  end
42
42
 
43
43
  it 'should map FirstAired' do
44
- klass.rules['FirstAired'].should == :first_aired
44
+ model.rules['FirstAired'].should == :first_aired
45
45
  end
46
46
 
47
47
  it 'should map GuestStars' do
48
- klass.rules['GuestStars'].should == :guest_stars
48
+ model.rules['GuestStars'].should == :guest_stars
49
49
  end
50
50
 
51
51
  it 'should map IMDB_ID' do
52
- klass.rules['IMDB_ID'].should == :imdb_id
52
+ model.rules['IMDB_ID'].should == :imdb_id
53
53
  end
54
54
 
55
55
  it 'should map Language' do
56
- klass.rules['Language'].should == :language
56
+ model.rules['Language'].should == :language
57
57
  end
58
58
 
59
59
  it 'should map Overview' do
60
- klass.rules['Overview'].should == :overview
60
+ model.rules['Overview'].should == :overview
61
61
  end
62
62
 
63
63
  it 'should map ProductionCode' do
64
- klass.rules['ProductionCode'].should == :production_code
64
+ model.rules['ProductionCode'].should == :production_code
65
65
  end
66
66
 
67
67
  it 'should map Rating' do
68
- klass.rules['Rating'].should == :rating
68
+ model.rules['Rating'].should == :rating
69
69
  end
70
70
 
71
71
  it 'should map RatingCount' do
72
- klass.rules['RatingCount'].should == :rating_count
72
+ model.rules['RatingCount'].should == :rating_count
73
73
  end
74
74
 
75
75
  it 'should map SeasonNumber' do
76
- klass.rules['SeasonNumber'].should == :season
76
+ model.rules['SeasonNumber'].should == :season
77
77
  end
78
78
 
79
79
  it 'should map Writer' do
80
- klass.rules['Writer'].should == :writer
80
+ model.rules['Writer'].should == :writer
81
81
  end
82
82
 
83
83
  it 'should map absolute_number' do
84
- klass.rules['absolute_number'].should == :absolute_number
84
+ model.rules['absolute_number'].should == :absolute_number
85
85
  end
86
86
 
87
87
  it 'should map airsafter_season' do
88
- klass.rules['airsafter_season'].should == :airs_after_season
88
+ model.rules['airsafter_season'].should == :airs_after_season
89
89
  end
90
90
 
91
91
  it 'should map airsbefore_episode' do
92
- klass.rules['airsbefore_episode'].should == :airs_before_episode
92
+ model.rules['airsbefore_episode'].should == :airs_before_episode
93
93
  end
94
94
 
95
95
  it 'should map airsbefore_season' do
96
- klass.rules['airsbefore_season'].should == :airs_before_season
96
+ model.rules['airsbefore_season'].should == :airs_before_season
97
97
  end
98
98
 
99
99
  it 'should map filename' do
100
- klass.rules['filename'].should == :filename_path
100
+ model.rules['filename'].should == :filename_path
101
101
  end
102
102
 
103
103
  it 'should map lastupdated' do
104
- klass.rules['lastupdated'].should == :last_updated_at
104
+ model.rules['lastupdated'].should == :last_updated_at
105
105
  end
106
106
 
107
107
  it 'should map seasonid' do
108
- klass.rules['seasonid'].should == :season_id
108
+ model.rules['seasonid'].should == :season_id
109
109
  end
110
110
 
111
111
  it 'should map seriesid' do
112
- klass.rules['seriesid'].should == :series_id
112
+ model.rules['seriesid'].should == :series_id
113
113
  end
114
114
 
115
115
  it 'should map thumb_added' do
116
- klass.rules['thumb_added'].should == :thumbnail_added_at
116
+ model.rules['thumb_added'].should == :thumbnail_added_at
117
117
  end
118
118
 
119
119
  it 'should map thumb_height' do
120
- klass.rules['thumb_height'].should == :thumbnail_height
120
+ model.rules['thumb_height'].should == :thumbnail_height
121
121
  end
122
122
 
123
123
  it 'should map thumb_width' do
124
- klass.rules['thumb_width'].should == :thumbnail_width
124
+ model.rules['thumb_width'].should == :thumbnail_width
125
125
  end
126
126
  end
127
127
 
128
128
  describe '#convert' do
129
129
  let(:input) { { director: true, guest_stars: true, writer: true, last_updated_at: 1} }
130
130
  let(:output) { { director: 'LIST', guest_stars: 'LIST', writer: 'LIST', last_updated_at: 'TIME'} }
131
+ let(:model) { ThetvdbMapper::Mapping::Episode.new(input) }
131
132
 
132
133
  before do
133
- klass.stub(:convert_to_list).and_return('LIST')
134
+ model.stub(:convert_to_list).and_return('LIST')
134
135
  Time.stub(:at).and_return('TIME')
135
136
  end
136
137
 
137
138
  it 'should return correct hash' do
138
- klass.convert(input).should == output
139
+ model.convert.should == output
139
140
  end
140
141
  end
141
142
  end
@@ -1,113 +1,114 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ThetvdbMapper::Mapping::Series do
4
- let(:klass) { ThetvdbMapper::Mapping::Series }
4
+ let(:model) { ThetvdbMapper::Mapping::Series.new({}) }
5
5
 
6
6
  describe '#rules' do
7
7
  it 'should map id' do
8
- klass.rules['id'].should == :id
8
+ model.rules['id'].should == :id
9
9
  end
10
10
 
11
11
  it 'should map Airs_DayOfWeek' do
12
- klass.rules['Airs_DayOfWeek'].should == :airs_day_of_week
12
+ model.rules['Airs_DayOfWeek'].should == :airs_day_of_week
13
13
  end
14
14
 
15
15
  it 'should map Airs_Time' do
16
- klass.rules['Airs_Time'].should == :airs_time
16
+ model.rules['Airs_Time'].should == :airs_time
17
17
  end
18
18
 
19
19
  it 'should map ContentRating' do
20
- klass.rules['ContentRating'].should == :content_rating
20
+ model.rules['ContentRating'].should == :content_rating
21
21
  end
22
22
 
23
23
  it 'should map FirstAired' do
24
- klass.rules['FirstAired'].should == :first_aired
24
+ model.rules['FirstAired'].should == :first_aired
25
25
  end
26
26
 
27
27
  it 'should map Genre' do
28
- klass.rules['Genre'].should == :genres
28
+ model.rules['Genre'].should == :genres
29
29
  end
30
30
 
31
31
  it 'should map IMDB_ID' do
32
- klass.rules['IMDB_ID'].should == :imdb_id
32
+ model.rules['IMDB_ID'].should == :imdb_id
33
33
  end
34
34
 
35
35
  it 'should map Language' do
36
- klass.rules['Language'].should == :language
36
+ model.rules['Language'].should == :language
37
37
  end
38
38
 
39
39
  it 'should map Network' do
40
- klass.rules['Network'].should == :network
40
+ model.rules['Network'].should == :network
41
41
  end
42
42
 
43
43
  it 'should map NetworkID' do
44
- klass.rules['NetworkID'].should == :network_id
44
+ model.rules['NetworkID'].should == :network_id
45
45
  end
46
46
 
47
47
  it 'should map Overview' do
48
- klass.rules['Overview'].should == :overview
48
+ model.rules['Overview'].should == :overview
49
49
  end
50
50
 
51
51
  it 'should map Rating' do
52
- klass.rules['Rating'].should == :rating
52
+ model.rules['Rating'].should == :rating
53
53
  end
54
54
 
55
55
  it 'should map RatingCount' do
56
- klass.rules['RatingCount'].should == :rating_count
56
+ model.rules['RatingCount'].should == :rating_count
57
57
  end
58
58
 
59
59
  it 'should map Runtime' do
60
- klass.rules['Runtime'].should == :runtime
60
+ model.rules['Runtime'].should == :runtime
61
61
  end
62
62
 
63
63
  it 'should map SeriesName' do
64
- klass.rules['SeriesName'].should == :name
64
+ model.rules['SeriesName'].should == :name
65
65
  end
66
66
 
67
67
  it 'should map Status' do
68
- klass.rules['Status'].should == :status
68
+ model.rules['Status'].should == :status
69
69
  end
70
70
 
71
71
  it 'should map added' do
72
- klass.rules['added'].should == :added_at
72
+ model.rules['added'].should == :added_at
73
73
  end
74
74
 
75
75
  it 'should map addedBy' do
76
- klass.rules['addedBy'].should == :added_by
76
+ model.rules['addedBy'].should == :added_by
77
77
  end
78
78
 
79
79
  it 'should map banner' do
80
- klass.rules['banner'].should == :banner_path
80
+ model.rules['banner'].should == :banner_path
81
81
  end
82
82
 
83
83
  it 'should map fanart' do
84
- klass.rules['fanart'].should == :fanart_path
84
+ model.rules['fanart'].should == :fanart_path
85
85
  end
86
86
 
87
87
  it 'should map lastupdated' do
88
- klass.rules['lastupdated'].should == :last_updated_at
88
+ model.rules['lastupdated'].should == :last_updated_at
89
89
  end
90
90
 
91
91
  it 'should map poster' do
92
- klass.rules['poster'].should == :poster_path
92
+ model.rules['poster'].should == :poster_path
93
93
  end
94
94
 
95
95
  it 'should map zap2it_id' do
96
- klass.rules['zap2it_id'].should == :zap2it_id
96
+ model.rules['zap2it_id'].should == :zap2it_id
97
97
  end
98
98
  end
99
99
 
100
100
  describe '#convert' do
101
101
  let(:input) { { genres: true, last_updated_at: 1} }
102
102
  let(:output) { { genres: 'LIST', last_updated_at: 'TIME'} }
103
+ let(:model) { ThetvdbMapper::Mapping::Series.new(input) }
103
104
 
104
105
  before do
105
- klass.stub(:convert_to_list).and_return('LIST')
106
+ model.stub(:convert_to_list).and_return('LIST')
106
107
  Time.stub(:at).and_return('TIME')
107
108
  end
108
109
 
109
110
  it 'should return correct hash' do
110
- klass.convert(input).should == output
111
+ model.convert.should == output
111
112
  end
112
113
  end
113
114
  end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ThetvdbMapper::Mapping::StringList do
4
- let(:klass) { ThetvdbMapper::Mapping::StringList }
4
+ let(:model) { ThetvdbMapper::Mapping::StringList.new('|test|') }
5
5
 
6
6
  describe '#map' do
7
7
  it 'should return array' do
8
- klass.map('|test|').should == ['test']
8
+ model.map.should == ['test']
9
9
  end
10
10
  end
11
11
  end
@@ -9,7 +9,8 @@ describe ThetvdbMapper::Series do
9
9
  end
10
10
 
11
11
  it 'should call map on mapping class' do
12
- ThetvdbMapper::Mapping::Series.should_receive(:map).with(sample: true)
12
+ model.stub(:mapping_object).and_return(double(map: true))
13
+ model.mapping_object(sample: true).should_receive(:map)
13
14
  model.data
14
15
  end
15
16
  end
@@ -23,4 +24,10 @@ describe ThetvdbMapper::Series do
23
24
  model.inspect.should == '<ThetvdbMapper::Series data=DATA >'
24
25
  end
25
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
26
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thetvdb_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Wawer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-06 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thetvdb_api