thetvdb_party 0.0.11.pre → 0.0.12.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: caaeef9e167cb8951dd7d04ce0ba6bfc23d56df1
4
- data.tar.gz: 33c2b4c2cec606d65479e648e1816f6046b7b245
3
+ metadata.gz: 3fa2e06a9e0a3b23ca038ed937b7ff0a838f8361
4
+ data.tar.gz: fd44b41771d89e6599a234718e5352fbfac3f927
5
5
  SHA512:
6
- metadata.gz: b355f88c52e93986891f815a49a8bc0e6ce0124d9c78eb4ddfebda08a44e2e58aa6ccec3257a7735c67bac79f7ac881ba69a54b56385a365e8f7e02c6843cf18
7
- data.tar.gz: 454d5ef95c960f476f0c1ce577620b72e8217bfbe4a3ccc600aa2a44c153ad5d5599956a8014d64453d7ed6c32f875b9a71bb651ab78ca8d190506fc54cb6717
6
+ metadata.gz: 5a8a9f704ea9fca9286719ebf7a2903e364533f23fa32925160c0f4e53e2aebc9dde33da2c96c2bb13a4050c52f6f40b0700e2480362695c73a8000adb724f31
7
+ data.tar.gz: e239e79646c9a7627d4b16d961b7c57a2a3e0d19e74abf7ed794cb71f1b861682911c5b38c271c166becaaad8a9bdf85a16b14db386f7ff1659e4e90e51986d4
data/.gitignore CHANGED
@@ -200,7 +200,8 @@ ModelManifest.xml
200
200
 
201
201
  /.idea/
202
202
  /.bundle/
203
- /.yardoc
203
+ /.yardoc/
204
+ /.report/
204
205
  /Gemfile.lock
205
206
  /_yardoc/
206
207
  /coverage/
data/Rakefile CHANGED
@@ -10,5 +10,11 @@ RDoc::Task.new do |rdoc|
10
10
  end
11
11
 
12
12
  RSpec::Core::RakeTask.new do |rspec|
13
- rspec.pattern = 'spec/**/*_spec.rb'
13
+ end
14
+
15
+ namespace :spec do
16
+ RSpec::Core::RakeTask.new :html do |rspec|
17
+ rspec.name = "spec::html"
18
+ rspec.rspec_opts = %w(--format html --out .report/rspec_test_report.html)
19
+ end
14
20
  end
@@ -158,7 +158,7 @@ module TheTvDbParty
158
158
  @productioncode = @hashValues["ProductionCode"]
159
159
  @rating = @hashValues["Rating"] ? @hashValues["Rating"].to_f : 0.0
160
160
  @ratingcount = @hashValues["RatingCount"] ? @hashValues["RatingCount"].to_i : 0
161
- @seasonnumber = @hashValues["SeasonNumber"] ? @hashValues["RatingCount"].to_i : -1
161
+ @seasonnumber = @hashValues["SeasonNumber"] ? @hashValues["SeasonNumber"].to_i : -1
162
162
  @writer = @hashValues["Writer"] ? @hashValues["Writer"].split('|').reject { |a| a.nil? || a.empty? } : []
163
163
  @absolute_number = @hashValues["absolute_number"] ? @hashValues["absolute_number"].to_i : -1
164
164
  @airsafter_season = @hashValues["airsafter_season"] ? @hashValues["airsafter_season"].to_i : -1
@@ -128,7 +128,7 @@ module TheTvDbParty
128
128
  @airs_dayofweek = @hashValues["Airs_DayOfWeek"]
129
129
  @airs_time = @hashValues["Airs_Time"] ? Time.parse(@hashValues["Airs_Time"]) : nil
130
130
  @contentrating = @hashValues["ContentRating"]
131
- @firstaired = @hashValues["FirstAired"] ? Date.parse(hashValues["FirstAired"]) : nil
131
+ @firstaired = @hashValues["FirstAired"] ? Date.parse(@hashValues["FirstAired"]) : nil
132
132
  @genres = @hashValues["Genre"] ? @hashValues["Genre"].split('|').reject { |a| a.nil? || a.empty? } : []
133
133
  @imdb_id = @hashValues["IMDB_ID"]
134
134
  @language = @hashValues["Language"]
@@ -1,4 +1,4 @@
1
1
  module TheTvDbParty
2
2
  # The current version of the *thetvdb_party* gem
3
- VERSION = "0.0.11.pre"
3
+ VERSION = "0.0.12.pre"
4
4
  end
@@ -1,26 +1,76 @@
1
1
  require 'rspec'
2
2
  require 'thetvdb_party'
3
3
 
4
- describe 'Actor' do
4
+ describe 'TheTvDbParty::Actor' do
5
+ it 'should have a client associated with it' do
6
+ client = TheTvDbParty::Client.new(nil)
7
+ record = TheTvDbParty::Actor.new(client, { })
8
+ expect(record.client).to be_an_instance_of(TheTvDbParty::Client)
9
+ end
10
+
11
+ it 'should have a nil client if constructed with nil' do
12
+ record = TheTvDbParty::Actor.new(nil, { })
13
+ expect(record.client).to be_nil
14
+ end
15
+
16
+ it 'should have an ignored id field' do
17
+ record = TheTvDbParty::Actor.new(nil, { "id" => "27747" })
18
+ expect(record.id).to be_an_instance_of(String)
19
+ expect(record.id).to eq("27747")
20
+ end
21
+
22
+ it 'should have a nil id, if not specified' do
23
+ record = TheTvDbParty::Actor.new(nil, {})
24
+ expect(record.id).to be_nil
25
+ end
26
+
27
+ it 'should have a relative/full image path' do
28
+ record = TheTvDbParty::Actor.new(nil, { "Image" => "actors/27747.jpg" })
29
+ expect(record.imagepath_relative).to be_an_instance_of(String)
30
+ expect(record.imagepath_full).to be_an_instance_of(URI)
31
+ expect(record.imagepath_relative).to eq("actors/27747.jpg")
32
+ expect(record.imagepath_full).to eq(URI::join(TheTvDbParty::BASE_URL, 'banners/', 'actors/27747.jpg'))
33
+ end
34
+
35
+ it 'should have a nil relative/full image path, if not specified' do
36
+ record = TheTvDbParty::Actor.new(nil, {})
37
+ expect(record.imagepath_relative).to be_nil
38
+ expect(record.imagepath_full).to be_nil
39
+ end
40
+
41
+ it 'should have a name field' do
42
+ record = TheTvDbParty::Actor.new(nil, { "Name" => "Matthew Fox" })
43
+ expect(record.name).to be_an_instance_of(String)
44
+ expect(record.name).to eq("Matthew Fox")
45
+ end
46
+
47
+ it 'should have a nil name, if not specified' do
48
+ record = TheTvDbParty::Actor.new(nil, {})
49
+ expect(record.name).to be_nil
50
+ end
5
51
 
6
- before(:each) do
7
- @valid_actor = TheTvDbParty::Actor.new(nil,
8
- {
9
- "id" => "0"
10
- }
11
- )
12
- @invalid_actor = TheTvDbParty::Actor.new(nil, { })
52
+ it 'should have a sorting order between 0-3' do
53
+ record = TheTvDbParty::Actor.new(nil, { "SortOrder" => "2" })
54
+ expect(record.sortOrder).to be_an_instance_of(Fixnum)
55
+ expect(record.sortOrder).to be_between(0, 3).inclusive
56
+ expect(record.sortOrder).to eq(2)
13
57
  end
14
58
 
15
- it 'should have an id when valid' do
16
- expect @valid_actor.id == 0
59
+ it 'should have a 0 sorting order, if invalid specified' do
60
+ record = TheTvDbParty::Actor.new(nil, { "SortOrder" => "INVALID_SORT_ORDER" })
61
+ expect(record.sortOrder).to be_an_instance_of(Fixnum)
62
+ expect(record.sortOrder).to be_between(0, 3).inclusive
63
+ expect(record.sortOrder).to eq(0)
17
64
  end
18
65
 
19
- it 'should have a negative id when invalid' do
20
- expect @invalid_actor.id < 0
66
+ it 'should have a 0 sorting order, if invalid specified' do
67
+ record = TheTvDbParty::Actor.new(nil, { })
68
+ expect(record.sortOrder).to be_an_instance_of(Fixnum)
69
+ expect(record.sortOrder).to be_between(0, 3).inclusive
70
+ expect(record.sortOrder).to eq(0)
21
71
  end
22
72
 
23
73
  it 'should not instantiate when created without hash values' do
24
- expect{TheTvDbParty::Actor.new(nil, nil)}.to raise_error
74
+ expect { TheTvDbParty::Actor.new(nil, nil) }.to raise_error
25
75
  end
26
76
  end
@@ -1,26 +1,233 @@
1
1
  require 'rspec'
2
2
  require 'thetvdb_party'
3
3
 
4
- describe 'Banner' do
4
+ describe 'TheTvDbParty::Banner' do
5
+ it 'should have a client associated with it' do
6
+ client = TheTvDbParty::Client.new(nil)
7
+ record = TheTvDbParty::Banner.new(client, { })
8
+ expect(record.client).to be_an_instance_of(TheTvDbParty::Client)
9
+ end
10
+
11
+ it 'should have a nil client if constructed with nil' do
12
+ record = TheTvDbParty::Banner.new(nil, { })
13
+ expect(record.client).to be_nil
14
+ end
15
+
16
+ it 'should have an ignored id field' do
17
+ record = TheTvDbParty::Banner.new(nil, { "id" => "14820" })
18
+ expect(record.id).to be_an_instance_of(String)
19
+ expect(record.id).to eq("14820")
20
+ end
21
+
22
+ it 'should have a nil id, if not specified' do
23
+ record = TheTvDbParty::Banner.new(nil, {})
24
+ expect(record.id).to be_nil
25
+ end
26
+
27
+ it 'should have a relative/full banner path' do
28
+ record = TheTvDbParty::Banner.new(nil, { "BannerPath" => "text/80348.jpg" })
29
+ expect(record.bannerpath_relative).to be_an_instance_of(String)
30
+ expect(record.bannerpath_full).to be_an_instance_of(URI)
31
+ expect(record.bannerpath_relative).to eq("text/80348.jpg")
32
+ expect(record.bannerpath_full).to eq(URI::join(TheTvDbParty::BASE_URL, 'banners/', "text/80348.jpg"))
33
+ end
34
+
35
+ it 'should have a nil relative/full banner path, if not specified' do
36
+ record = TheTvDbParty::Banner.new(nil, {})
37
+ expect(record.bannerpath_relative).to be_nil
38
+ expect(record.bannerpath_full).to be_nil
39
+ end
40
+
41
+ it 'should have a relative/full thumbnail path' do
42
+ record = TheTvDbParty::Banner.new(nil, { "ThumbnailPath" => "_cache/fanart/original/80348-49.jpg" })
43
+ expect(record.bannerpath_relative).to be_an_instance_of(String)
44
+ expect(record.bannerpath_full).to be_an_instance_of(URI)
45
+ expect(record.bannerpath_relative).to eq("_cache/fanart/original/80348-49.jpg")
46
+ expect(record.bannerpath_full).to eq(URI::join(TheTvDbParty::BASE_URL, 'banners/', "_cache/fanart/original/80348-49.jpg"))
47
+ end
48
+
49
+ it 'should have a nil relative/full thumbnail path, if not specified' do
50
+ record = TheTvDbParty::Banner.new(nil, {})
51
+ expect(record.bannerpath_relative).to be_nil
52
+ expect(record.bannerpath_full).to be_nil
53
+ end
54
+
55
+ it 'should have a relative/full vignette path' do
56
+ record = TheTvDbParty::Banner.new(nil, { "VignettePath" => "fanart/vignette/80348-49.jpg" })
57
+ expect(record.bannerpath_relative).to be_an_instance_of(String)
58
+ expect(record.bannerpath_full).to be_an_instance_of(URI)
59
+ expect(record.bannerpath_relative).to eq("fanart/vignette/80348-49.jpg")
60
+ expect(record.bannerpath_full).to eq(URI::join(TheTvDbParty::BASE_URL, 'banners/', "fanart/vignette/80348-49.jpg"))
61
+ end
62
+
63
+ it 'should have a nil relative/full vignette path, if not specified' do
64
+ record = TheTvDbParty::Banner.new(nil, {})
65
+ expect(record.bannerpath_relative).to be_nil
66
+ expect(record.bannerpath_full).to be_nil
67
+ end
68
+
69
+ it 'should have a banner type' do
70
+ [ "poster", "fanart", "series", "season" ].each do |expected_valid_bannertype|
71
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => expected_valid_bannertype })
72
+ expect(record.bannertype).to be_an_instance_of(String)
73
+ expect(record.bannertype).to eq(expected_valid_bannertype)
74
+ end
75
+ end
76
+
77
+ it 'should have a nil banner type, if specified is invalid' do
78
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => "INVALID_BANNERTYPE_STRING" })
79
+ expect(record.bannertype).to be_nil
80
+ end
81
+
82
+ it 'should have a nil banner type, if not specified' do
83
+ record = TheTvDbParty::Banner.new(nil, {})
84
+ expect(record.bannertype).to be_nil
85
+ end
86
+
87
+ it 'should have a secondary banner type' do
88
+ {
89
+ "poster" => [ "680x1000" ],
90
+ "fanart" => [ "1280x720", "1920x1080" ],
91
+ "series" => [ "text", "graphical", "blank" ],
92
+ "season" => [ "season", "seasonwide" ]
93
+ }.each do |expected_valid_bannertype, expected_valid_bannerytype2s|
94
+ expected_valid_bannerytype2s.each do |expected_valid_bannerytype2|
95
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => expected_valid_bannertype, "BannerType2" => expected_valid_bannerytype2 })
96
+ expect(record.bannertype2).to be_an_instance_of(String)
97
+ expect(record.bannertype2).to eq(expected_valid_bannerytype2)
98
+ end
99
+ end
100
+ end
101
+
102
+ it 'should have a nil secondary banner type, if the primary banner type is valid, but the specified secondary banner type is invalid' do
103
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => "poster", "BannerType2" => "abcdef" })
104
+ expect(record.bannertype2).to be_nil
105
+ end
106
+
107
+ it 'should have a nil secondary banner type, if the primary banner type is valid, but the specified secondary banner type is invalid for that primary banner type' do
108
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => "poster", "BannerType2" => "seasonwide" })
109
+ expect(record.bannertype2).to be_nil
110
+ end
111
+
112
+ it 'should have a nil secondary banner type, if the primary banner type is nil' do
113
+ record = TheTvDbParty::Banner.new(nil, { "BannerType2" => "seasonwide" })
114
+ expect(record.bannertype2).to be_nil
115
+ end
116
+
117
+ it 'should have a language associated with it' do
118
+ record = TheTvDbParty::Banner.new(nil, { "Language" => "en" })
119
+ expect(record.language).to be_an_instance_of(String)
120
+ expect(record.language.length).to be_between(2, 3).inclusive
121
+ expect(record.language).to eq("en")
122
+ end
123
+
124
+ it 'should have a nil language, if the language is not specified' do
125
+ record = TheTvDbParty::Banner.new(nil, { })
126
+ expect(record.language).to be_nil
127
+ end
128
+
129
+ it 'should have a season' do
130
+ record = TheTvDbParty::Banner.new(nil, { "Season" => "5" })
131
+ expect(record.season).to be_an_instance_of(Fixnum)
132
+ expect(record.season).to be >= 0
133
+ end
134
+
135
+ it 'should have a nil season, if it is not specified' do
136
+ record = TheTvDbParty::Banner.new(nil, { })
137
+ expect(record.season).to be_nil
138
+ end
139
+
140
+ it 'should have a rating' do
141
+ record = TheTvDbParty::Banner.new(nil, { "Rating" => "6.6667" })
142
+ expect(record.rating).to be_an_instance_of(Float)
143
+ expect(record.rating).to be >= 0.0
144
+ expect(record.rating).to be 6.6667
145
+ end
146
+
147
+ it 'should have a zero rating, if it is not specified' do
148
+ record = TheTvDbParty::Banner.new(nil, { })
149
+ expect(record.rating).to be_an_instance_of(Float)
150
+ expect(record.rating).to be 0.0
151
+ end
152
+
153
+ it 'should have a rating count' do
154
+ record = TheTvDbParty::Banner.new(nil, { "RatingCount" => "6" })
155
+ expect(record.rating).to be_an_instance_of(Fixnum)
156
+ expect(record.rating).to be >= 0
157
+ expect(record.rating).to be >= 6
158
+ end
159
+
160
+ it 'should have a zero rating count, if it is not specified' do
161
+ record = TheTvDbParty::Banner.new(nil, { })
162
+ expect(record.rating).to be_an_instance_of(Fixnum)
163
+ expect(record.rating).to be 0
164
+ end
165
+
166
+ it 'should have a true series name flag' do
167
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => "fanart", "SeriesName" => "true" })
168
+ expect(record.seriesName).to be_an_instance_of(TrueClass).or be_an_instance_of(FalseClass)
169
+ expect(record.seriesName).to be true
170
+ end
171
+
172
+ it 'should have a false series name flag, if banner type is not fanart' do
173
+ [ "poster", "series", "season" ].each do |expected_valid_bannertype|
174
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => expected_valid_bannertype, "SeriesName" => "true" })
175
+ expect(record.seriesName).to be_an_instance_of(TrueClass).or be_an_instance_of(FalseClass)
176
+ expect(record.seriesName).to be false
177
+ end
178
+ end
179
+
180
+ it 'should have a false series name flag, if it is not specified' do
181
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => "fanart", "SeriesName" => "true" })
182
+ expect(record.seriesName).to be_an_instance_of(TrueClass).or be_an_instance_of(FalseClass)
183
+ expect(record.seriesName).to be false
184
+ end
185
+
186
+ it 'should have a zero rating count, if it is not specified' do
187
+ record = TheTvDbParty::Banner.new(nil, { })
188
+ expect(record.rating).to be_an_instance_of(Fixnum)
189
+ expect(record.rating).to be 0
190
+ end
191
+
192
+ it 'should have the color fields' do
193
+ record = TheTvDbParty::Banner.new(nil, { "BannerType" => "fanart", "Colors" => "|81,81,81|15,15,15|201,226,246|" })
194
+ expect(record.light_accent_color).to be_an_instance_of(Array)
195
+ expect(record.light_accent_color).to match_array([81, 81, 81])
196
+ expect(record.dark_accent_color).to be_an_instance_of(Array)
197
+ expect(record.dark_accent_color).to match_array([15, 15, 15])
198
+ expect(record.midtone_color).to be_an_instance_of(Array)
199
+ expect(record.midtone_color).to match_array([201, 226, 246])
200
+ end
201
+
202
+ it 'should have nil color fields, if banner type is not fanart' do
203
+ record = TheTvDbParty::Banner.new(nil, { "Colors" => "|81,81,81|15,15,15|201,226,246|" })
204
+ expect(record.light_accent_color).to be_nil
205
+ expect(record.dark_accent_color).to be_nil
206
+ expect(record.midtone_color).to be_nil
207
+ end
5
208
 
6
- before(:each) do
7
- @valid_banner = TheTvDbParty::Banner.new(nil,
8
- {
9
- "id" => "0"
10
- }
11
- )
12
- @invalid_banner = TheTvDbParty::Banner.new(nil, { })
209
+ it 'should have nil color fields, if invalid colors are specified' do
210
+ record = TheTvDbParty::Banner.new(nil, { "Colors" => "INVALID_COLORS" })
211
+ expect(record.light_accent_color).to be_nil
212
+ expect(record.dark_accent_color).to be_nil
213
+ expect(record.midtone_color).to be_nil
13
214
  end
14
215
 
15
- it 'should have an id when valid' do
16
- expect @valid_banner.id == 0
216
+ it 'should have nil color fields, if no colors are specified' do
217
+ record = TheTvDbParty::Banner.new(nil, { })
218
+ expect(record.light_accent_color).to be_nil
219
+ expect(record.dark_accent_color).to be_nil
220
+ expect(record.midtone_color).to be_nil
17
221
  end
18
222
 
19
- it 'should have a negative id when invalid' do
20
- expect @invalid_banner.id < 0
223
+ it 'should have nil color fields, if colors are specified, but at least one of the colors does not have exactly three elements' do
224
+ record = TheTvDbParty::Banner.new(nil, { "Colors" => "|81,81,81,4|15,15,15|201,226,246|" })
225
+ expect(record.light_accent_color).to be_nil
226
+ expect(record.dark_accent_color).to be_nil
227
+ expect(record.midtone_color).to be_nil
21
228
  end
22
229
 
23
230
  it 'should not instantiate when created without hash values' do
24
- expect{TheTvDbParty::Banner.new(nil, nil)}.to raise_error
231
+ expect { TheTvDbParty::Banner.new(nil, nil) }.to raise_error
25
232
  end
26
233
  end
@@ -1,26 +1,151 @@
1
1
  require 'rspec'
2
2
  require 'thetvdb_party'
3
3
 
4
- describe 'BaseEpisodeRecord' do
4
+ describe 'TheTvDbParty::BaseEpisodeRecord' do
5
+ it 'should have a client associated with it' do
6
+ client = TheTvDbParty::Client.new(nil)
7
+ record = TheTvDbParty::BaseEpisodeRecord.new(client, { })
8
+ expect(record.client).to be_an_instance_of(TheTvDbParty::Client)
9
+ end
10
+
11
+ it 'should have a nil client if constructed with nil' do
12
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
13
+ expect(record.client).to be_nil
14
+ end
15
+
16
+ it 'should have an id' do
17
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "id" => "533011" })
18
+ expect(record.id).to be_an_instance_of(Fixnum)
19
+ expect(record.id).to eq(533011)
20
+ end
21
+
22
+ it 'should have a negative id, if invalid id specified' do
23
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "id" => "INVALID_ID" })
24
+ expect(record.id).to be_an_instance_of(Fixnum)
25
+ expect(record.id).to be < 0
26
+ end
27
+
28
+ it 'should have a negative id, if id not specified' do
29
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
30
+ expect(record.id).to be_an_instance_of(Fixnum)
31
+ expect(record.id).to be < 0
32
+ end
33
+
34
+ it 'should have a combined episode number' do
35
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "Combined_episodenumber" => "5.2" })
36
+ expect(record.combined_episodenumber).to be_an_instance_of(Float)
37
+ expect(record.combined_episodenumber).to eq(5.2)
38
+ end
39
+
40
+ it 'should have a negative combined episode number, if invalid specified' do
41
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "Combined_episodenumber" => "INVALID_COMBINED_EPISODE_NUMBER" })
42
+ expect(record.combined_episodenumber).to be_an_instance_of(Float)
43
+ expect(record.combined_episodenumber).to be < 0
44
+ end
45
+
46
+ it 'should have a negative combined episode number, if not specified' do
47
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
48
+ expect(record.combined_episodenumber).to be_an_instance_of(Float)
49
+ expect(record.combined_episodenumber).to be < 0
50
+ end
51
+
52
+ it 'should have a combined season number' do
53
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "Combined_season" => "5" })
54
+ expect(record.combined_season).to be_an_instance_of(Fixnum)
55
+ expect(record.combined_season).to eq(5)
56
+ end
57
+
58
+ it 'should have a negative combined episode number, if invalid specified' do
59
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "Combined_season" => "INVALID_COMBINED_SEASON" })
60
+ expect(record.combined_season).to be_an_instance_of(Fixnum)
61
+ expect(record.combined_season).to be < 0
62
+ end
63
+
64
+ it 'should have a negative combined episode number, if not specified' do
65
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
66
+ expect(record.combined_season).to be_an_instance_of(Fixnum)
67
+ expect(record.combined_season).to be < 0
68
+ end
69
+
70
+ it 'should have a DVD chapter field' do
71
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "DVD_chapter" => "5" })
72
+ expect(record.dvd_chapter).to be_an_instance_of(String)
73
+ expect(record.dvd_chapter).to eq("5")
74
+ end
75
+
76
+ it 'should have a nil DVD chapter field, if not specified' do
77
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
78
+ expect(record.dvd_chapter).to be_nil
79
+ end
80
+
81
+ it 'should have a DVD disc field' do
82
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "DVD_discid" => "5" })
83
+ expect(record.dvd_discid).to be_an_instance_of(String)
84
+ expect(record.dvd_discid).to eq("5")
85
+ end
86
+
87
+ it 'should have a nil DVD disc field, if not specified' do
88
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
89
+ expect(record.dvd_chapter).to be_nil
90
+ end
91
+
92
+ it 'should have a DVD episode number' do
93
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "DVD_episodenumber" => "1.2" })
94
+ expect(record.dvd_episodenumber).to be_an_instance_of(Float)
95
+ expect(record.dvd_episodenumber).to eq(1.2)
96
+ end
97
+
98
+ it 'should have a negative DVD episode number, if invalid specified' do
99
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "DVD_episodenumber" => "INVALID_DVD_EPISODENUMBER" })
100
+ expect(record.dvd_episodenumber).to be_an_instance_of(Float)
101
+ expect(record.dvd_episodenumber).to be < 0
102
+ end
103
+
104
+ it 'should have a negative DVD episode number, if not specified' do
105
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
106
+ expect(record.dvd_episodenumber).to be_an_instance_of(Float)
107
+ expect(record.dvd_episodenumber).to be < 0
108
+ end
109
+
110
+ it 'should have a DVD season number' do
111
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "DVD_season" => "1" })
112
+ expect(record.dvd_episodenumber).to be_an_instance_of(Fixnum)
113
+ expect(record.dvd_episodenumber).to eq(1.2)
114
+ end
115
+
116
+ it 'should have a negative DVD season number, if invalid specified' do
117
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "DVD_season" => "INVALID_DVD_SEASON" })
118
+ expect(record.dvd_episodenumber).to be_an_instance_of(Fixnum)
119
+ expect(record.dvd_episodenumber).to be < 0
120
+ end
121
+
122
+ it 'should have a negative DVD season number, if not specified' do
123
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
124
+ expect(record.dvd_episodenumber).to be_an_instance_of(Fixnum)
125
+ expect(record.dvd_episodenumber).to be < 0
126
+ end
127
+
128
+ it 'should have a single element array for the director, if only one name is specified' do
129
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "Director" => "Graeme Harper" })
130
+ expect(record.director).to match_array(["Graeme Harper"])
131
+ end
5
132
 
6
- before(:each) do
7
- @valid_record = TheTvDbParty::BaseEpisodeRecord.new(nil,
8
- {
9
- "id" => "0"
10
- }
11
- )
12
- @invalid_record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
133
+ it 'should have a multi element array for the director, if a pipe-delimited list is specified' do
134
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "Director" => "Bruno Heller|Tom Szentgyorgyi|Jordan Harper" })
135
+ expect(record.director).to match_array(["Bruno Heller", "Tom Szentgyorgyi", "Jordan Harper"])
13
136
  end
14
137
 
15
- it 'should have an id when valid' do
16
- expect @valid_record.id == 0
138
+ it 'should have a multi element array for the director, if a pipe-surrounded list is specified' do
139
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { "Director" => "|Bruno Heller|Tom Szentgyorgyi|Jordan Harper|" })
140
+ expect(record.director).to match_array(["Bruno Heller", "Tom Szentgyorgyi", "Jordan Harper"])
17
141
  end
18
142
 
19
- it 'should have a negative id when invalid' do
20
- expect @invalid_record.id < 0
143
+ it 'should have an empty array for director, if none is specified' do
144
+ record = TheTvDbParty::BaseEpisodeRecord.new(nil, { })
145
+ expect(record.director).to be_empty
21
146
  end
22
147
 
23
148
  it 'should not instantiate when created without hash values' do
24
- expect{TheTvDbParty::BaseEpisodeRecord.new(nil, nil)}.to raise_error
149
+ expect { TheTvDbParty::BaseEpisodeRecord.new(nil, nil) }.to raise_error
25
150
  end
26
151
  end
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "bundler", "~> 1.7"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.2"
30
+ spec.add_development_dependency "coderay", "~> 1.1"
30
31
 
31
32
  spec.add_dependency "httparty", "~> 0.6"
32
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thetvdb_party
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11.pre
4
+ version: 0.0.12.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fredrik Høisæther Rasch
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-02-23 00:00:00.000000000 Z
15
+ date: 2015-02-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -56,6 +56,20 @@ dependencies:
56
56
  - - "~>"
57
57
  - !ruby/object:Gem::Version
58
58
  version: '3.2'
59
+ - !ruby/object:Gem::Dependency
60
+ name: coderay
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - "~>"
64
+ - !ruby/object:Gem::Version
65
+ version: '1.1'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '1.1'
59
73
  - !ruby/object:Gem::Dependency
60
74
  name: httparty
61
75
  requirement: !ruby/object:Gem::Requirement