bbc_redux 0.4.0.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,151 @@
1
+ require 'spec_helper'
2
+
3
+ describe BBC::Redux::MediaUrl do
4
+
5
+ BBC::Redux::MediaUrl::TEMPLATES.each do |type|
6
+ it "should initialize correctly when given a the #{type} type" do
7
+ expect { generate_url :type => type }.to_not raise_error
8
+ end
9
+ end
10
+
11
+ it 'should not initialize when given an invalid transcode type' do
12
+ expect { generate_url :type => :foobar }.to raise_error
13
+ end
14
+
15
+ describe '#end_point' do
16
+
17
+ it 'allows includes the host' do
18
+ BBC::Redux::MediaUrl::TEMPLATES.each do |type|
19
+ url = generate_url :type => type
20
+ expect(url.end_point).to match(/^https:\/\/i.bbcredux.com\/asset/)
21
+ end
22
+ end
23
+
24
+ it 'allows you to specify an explicit filename' do
25
+ BBC::Redux::MediaUrl::TEMPLATES.each do |type|
26
+ url = generate_url :type => type
27
+ expect(url.end_point('foobar.file')).to match(/foobar\.file$/)
28
+ end
29
+ end
30
+
31
+ it 'has correct value when we\'re an dvbsubs url' do
32
+ url = generate_url :type => :dvbsubs, :identifier => 'abc'
33
+ expect(url.end_point).to \
34
+ match(/\/asset\/media\/abc\/#{url.key.value}\/dvbsubs\/abc.xml$/)
35
+ end
36
+
37
+ it 'has correct value when we\'re an flv url' do
38
+ url = generate_url :type => :flv, :identifier => 'abc'
39
+ expect(url.end_point).to \
40
+ match(/\/asset\/media\/abc\/#{url.key.value}\/Flash_v1.0\/abc.flv$/)
41
+ end
42
+
43
+ it 'has correct value when we\'re an h264_hi url' do
44
+ url = generate_url :type => :h264_hi, :identifier => 'abc'
45
+ expect(url.end_point).to \
46
+ match(/\/asset\/media\/abc\/#{url.key.value}\/h264_mp4_hi_v1.1\/abc-h264lg.mp4$/)
47
+ end
48
+
49
+ it 'has correct value when we\'re an h264_lo url' do
50
+ url = generate_url :type => :h264_lo, :identifier => 'abc'
51
+ expect(url.end_point).to \
52
+ match(/\/asset\/media\/abc\/#{url.key.value}\/h264_mp4_lo_v1.0\/abc-h264sm.mp4$/)
53
+ end
54
+
55
+ it 'has correct value when we\'re an mp3 url' do
56
+ url = generate_url :type => :mp3, :identifier => 'abc'
57
+ expect(url.end_point).to \
58
+ match(/\/asset\/media\/abc\/#{url.key.value}\/MP3_v1.0\/abc.mp3$/)
59
+ end
60
+
61
+ it 'has correct value when we\'re a ts url' do
62
+ url = generate_url :type => :ts, :identifier => 'abc'
63
+ expect(url.end_point).to \
64
+ match(/\/asset\/media\/abc\/#{url.key.value}\/ts\/abc.mpegts$/)
65
+ end
66
+
67
+ it 'has correct value when we\'re a ts_stripped url' do
68
+ url = generate_url :type => :ts_stripped, :identifier => 'abc'
69
+ expect(url.end_point).to \
70
+ match(/\/asset\/media\/abc\/#{url.key.value}\/strip\/abc-stripped.mpegts$/)
71
+ end
72
+ end
73
+
74
+ describe '#to_s' do
75
+ it 'should be the same as #end_point' do
76
+ url = generate_url
77
+ expect(url.to_s).to eq(url.end_point)
78
+ end
79
+ end
80
+
81
+ describe '#expires_at' do
82
+ it 'should be the same as the key\'s expires at time' do
83
+ time = Time.now
84
+ expect(generate_url(:expires_at => time).expires_at.to_time.to_i).to \
85
+ be(time.to_i)
86
+ end
87
+ end
88
+
89
+ describe '#expired?' do
90
+ it 'should be true when expires_at is in the past' do
91
+ expect(generate_url(:expires_at => Time.now - 300).expired?).to be(true)
92
+ end
93
+
94
+ it 'should be false when expires_at is in the future' do
95
+ expect(generate_url(:expires_at => Time.now + 300).expired?).to be(false)
96
+ end
97
+ end
98
+
99
+ describe '#live?' do
100
+ it 'should be false when expires_at is in the past' do
101
+ expect(generate_url(:expires_at => Time.now - 300).live?).to be(false)
102
+ end
103
+
104
+ it 'should be true when expires_at is in the future' do
105
+ expect(generate_url(:expires_at => Time.now + 300).live?).to be(true)
106
+ end
107
+ end
108
+
109
+ describe '#ttl' do
110
+ it 'should return the key\'s TLL in seconds' do
111
+ expect(generate_url.ttl).to be_within(1).of(0)
112
+ end
113
+ end
114
+
115
+ describe '#==' do
116
+ it 'should be true if urls have same identifier, type and key' do
117
+ expect(generate_url).to eq(generate_url)
118
+ end
119
+
120
+ it 'should be false if urls have different identifiers' do
121
+ expect(generate_url).to_not eq(generate_url(:identifier => '54321'))
122
+ end
123
+
124
+ it 'should be false if urls have different types' do
125
+ expect(generate_url).to_not eq(generate_url(:type => :dvbsubs))
126
+ end
127
+
128
+ it 'should be false if urls have different keys' do
129
+ expect(generate_url).to_not eq(generate_url(:expires_at => Time.now - 10))
130
+ end
131
+
132
+ it 'should be false if other key is something else' do
133
+ expect(generate_url).to_not eq(:something_else)
134
+ end
135
+ end
136
+
137
+ private
138
+
139
+ def generate_url(options = { })
140
+ identifier = options[:identifier] || '12345'
141
+ expires_at = options[:expires_at] || Time.now
142
+ type = options[:type] || :mp3
143
+ described_class.new( identifier, type, generate_key(expires_at) )
144
+ end
145
+
146
+ def generate_key(expires_at = Time.now)
147
+ BBC::Redux::Key.new "1-#{expires_at.to_i}-ba632af7af1adb6f96dbeceb83331ad6"
148
+ end
149
+
150
+ end
151
+
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe BBC::Redux::SearchResults do
4
+
5
+ let(:json) { read_fixture 'search_results.json' }
6
+
7
+ let(:mapper) { BBC::Redux::Serializers::SearchResults }
8
+
9
+ let(:object) { described_class.new }
10
+
11
+ subject { mapper.new(object).from_json(json) }
12
+
13
+ {
14
+
15
+ # attr / method => expected_value
16
+ 'created_at' => DateTime.parse('2014-04-15 17:35:42 +0100'),
17
+ 'offset' => 10,
18
+ 'query_time' => 0.166,
19
+ 'total' => 25435,
20
+ 'total_returned' => 10,
21
+
22
+ }.each_pair do |attribute, value|
23
+ its(attribute) { should eq(value) }
24
+ end
25
+
26
+ describe '#assets' do
27
+ it 'should represent the assets listed in the results' do
28
+ expect(subject.assets.size).to be(10)
29
+ expect(subject.assets.first.name).to eq("Bargain Hunt")
30
+
31
+ expect(subject.assets.first.uuid).to \
32
+ eq('87ba761a-2fb7-4437-a7bd-f358269e537c')
33
+
34
+ expect(subject.assets.first.description).to \
35
+ eq('Edinburgh: Bargain Hunt visits Scotland\'s capital')
36
+
37
+ expect(subject.assets.first.key).to \
38
+ eq(BBC::Redux::Key.new('1-1397666142-936014a77cbe46ada46c2e114676a86b'))
39
+
40
+
41
+ expect(subject.assets.first.start).to \
42
+ eq(DateTime.parse('2014-04-15 12:15:00 +0100'))
43
+
44
+ expect(subject.assets.first.channel.name).to eq('bbcone')
45
+ expect(subject.assets.first.duration).to eq(2700)
46
+ expect(subject.assets.first.reference).to eq('6002476641954360370')
47
+
48
+ end
49
+ end
50
+
51
+ describe '#has_more?' do
52
+ it 'should be false when offset + total_returned >= total' do
53
+ results = described_class.new({
54
+ :offset => 20, :total_returned => 10, :total => 30
55
+ })
56
+
57
+ expect(results.has_more?).to be(false)
58
+ end
59
+
60
+ it 'should be true when offset + total_returned < total' do
61
+ results = described_class.new({
62
+ :offset => 20, :total_returned => 10, :total => 40
63
+ })
64
+
65
+ expect(results.has_more?).to be(true)
66
+ end
67
+ end
68
+
69
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe BBC::Redux::User do
4
+
5
+ let(:json) { read_fixture 'user.json' }
6
+
7
+ let(:user) { described_class.new }
8
+
9
+ let(:mapper) { BBC::Redux::Serializers::User }
10
+
11
+ subject { mapper.new(user).from_json(json) }
12
+
13
+ {
14
+
15
+ # attribute_name => expected_value
16
+ :can_invite => false,
17
+ :can_invite? => false,
18
+ :created => DateTime.parse('2008-01-01 01:01:01 +0000'),
19
+ :department => 'My Department',
20
+ :division => 'My Division',
21
+ :email => 'mail@example.com',
22
+ :first_name => 'Jane',
23
+ :id => 1234,
24
+ :last_name => 'Smith',
25
+ :legal_accepted => false,
26
+ :legal_html => '<h1>Action Required</h1>',
27
+ :must_sign_terms? => true,
28
+ :name => 'Jane Smith',
29
+ :permitted_services => [ 'uk.bbc.radio', 'uk.bbc.tv' ],
30
+ :username => 'jsmith',
31
+ :uuid => 'eac522fe-313a-453e-97b0-d33e6fd50c62'
32
+
33
+ }.each_pair do |attribute, value|
34
+ its(attribute) { should eq(value) }
35
+ end
36
+
37
+ end
@@ -0,0 +1,24 @@
1
+ {
2
+ "name" : "Pingu",
3
+ "channel" : {
4
+ "name" : "cbeebies",
5
+ "display_name" : "CBeebies"
6
+ },
7
+ "uuid" : "26a141fc-8511-4fef-aa2b-af1d1de5a75a",
8
+ "description" : "Animated adventures of Pingu. [S]",
9
+ "tags" : [
10
+ {
11
+ "text" : "penguin"
12
+ },
13
+ {
14
+ "text" : "not_stoat"
15
+ }
16
+ ],
17
+ "key" : "1-1397227462-ba632af7af1ad",
18
+ "timing" : {
19
+ "duration" : 300,
20
+ "start" : "2014-01-08 06:50:00 +0000"
21
+ },
22
+ "reference" : 5966413090093319525
23
+ }
24
+
@@ -0,0 +1,28 @@
1
+ [
2
+ {
3
+ "priority" : 1000,
4
+ "id" : 1,
5
+ "description" : "BBC TV"
6
+ },
7
+ {
8
+ "priority" : 2000,
9
+ "id" : 2,
10
+ "description" : "BBC Radio"
11
+ },
12
+ {
13
+ "priority" : 3000,
14
+ "id" : 3,
15
+ "description" : "BBC HD"
16
+ },
17
+ {
18
+ "priority" : 4000,
19
+ "id" : 4,
20
+ "description" : "BBC Olympics"
21
+ },
22
+ {
23
+ "priority" : 5000,
24
+ "id" : 5,
25
+ "description" : "BBC Olympics HD"
26
+ }
27
+ ]
28
+
@@ -0,0 +1,51 @@
1
+ [
2
+ {
3
+ "longname" : "BBC One",
4
+ "name" : "bbcone",
5
+ "category" : 1,
6
+ "sortorder" : 1010
7
+ },
8
+ {
9
+ "longname" : "BBC Two",
10
+ "name" : "bbctwo",
11
+ "category" : 1,
12
+ "sortorder" : 1020
13
+ },
14
+ {
15
+ "longname" : "BBC Three",
16
+ "name" : "bbcthree",
17
+ "category" : 1,
18
+ "sortorder" : 1030
19
+ },
20
+ {
21
+ "longname" : "BBC Four",
22
+ "name" : "bbcfour",
23
+ "category" : 1,
24
+ "sortorder" : 1040
25
+ },
26
+ {
27
+ "longname" : "Radio 1",
28
+ "name" : "bbcr1",
29
+ "category" : 2,
30
+ "sortorder" : 2010
31
+ },
32
+ {
33
+ "longname" : "Radio 1 Xtra",
34
+ "name" : "bbc1x",
35
+ "category" : 2,
36
+ "sortorder" : 2015
37
+ },
38
+ {
39
+ "longname" : "Radio 2",
40
+ "name" : "bbcr2",
41
+ "category" : 2,
42
+ "sortorder" : 2020
43
+ },
44
+ {
45
+ "longname" : "Radio 3",
46
+ "name" : "bbcr3",
47
+ "category" : 2,
48
+ "sortorder" : 2030
49
+ }
50
+ ]
51
+
@@ -0,0 +1,172 @@
1
+ {
2
+ "total_returned" : 10,
3
+ "total_found" : 25435,
4
+ "time" : "2014-04-15 17:35:42 +0100",
5
+ "elapsed" : "0.166",
6
+ "results" : {
7
+ "assets" : [
8
+ {
9
+ "name" : "Bargain Hunt",
10
+ "channel" : {
11
+ "name" : "bbcone",
12
+ "display_name" : "BBC One"
13
+ },
14
+ "uuid" : "87ba761a-2fb7-4437-a7bd-f358269e537c",
15
+ "description" : "Edinburgh: Bargain Hunt visits Scotland's capital",
16
+ "tags" : [],
17
+ "key" : "1-1397666142-936014a77cbe46ada46c2e114676a86b",
18
+ "timing" : {
19
+ "duration" : 2700,
20
+ "start" : "2014-04-15 12:15:00 +0100"
21
+ },
22
+ "reference" : 6002476641954360370
23
+ },
24
+ {
25
+ "name" : "Bargain Hunt",
26
+ "channel" : {
27
+ "name" : "bbcone",
28
+ "display_name" : "BBC One"
29
+ },
30
+ "uuid" : "0d3846b5-4e65-48af-8fd3-9cad2fe7ff1b",
31
+ "description" : "Edinburgh: Bargain Hunt visits Scotland's capital, where two teams compete to see who can make the most money at auction. Their experts are Charles Hanson and David Barby. [AD,S]",
32
+ "tags" : [],
33
+ "key" : "1-1397666142-936014a77cbe46ada46c2e114676a86b",
34
+ "timing" : {
35
+ "duration" : 2700,
36
+ "start" : "2014-04-15 12:15:00 +0100"
37
+ },
38
+ "reference" : 6002476641954360370
39
+ },
40
+ {
41
+ "name" : "Saints and Scroungers",
42
+ "channel" : {
43
+ "name" : "bbcone",
44
+ "display_name" : "BBC One"
45
+ },
46
+ "uuid" : "56e11e2e-e20f-4317-bd22-e74274f4bd69",
47
+ "description" : "2/20. The case of an apparently jobless single mother who may be better off than she lets on. Also in HD. [S]",
48
+ "tags" : [],
49
+ "key" : "1-1397666142-66d9c463c8e9540cd5ef3adf9685bee8",
50
+ "timing" : {
51
+ "duration" : 1800,
52
+ "start" : "2014-04-15 11:45:00 +0100"
53
+ },
54
+ "reference" : 6002468911013227569
55
+ },
56
+ {
57
+ "name" : "Saints and Scroungers",
58
+ "channel" : {
59
+ "name" : "bbcone",
60
+ "display_name" : "BBC One"
61
+ },
62
+ "uuid" : "82708c0e-3291-42e2-af24-05be0da52ef4",
63
+ "description" : "2/20. The case of an apparently jobless single mother who may be better off than she lets on. Also in HD. [S]",
64
+ "tags" : [],
65
+ "key" : "1-1397666142-66d9c463c8e9540cd5ef3adf9685bee8",
66
+ "timing" : {
67
+ "duration" : 1800,
68
+ "start" : "2014-04-15 11:45:00 +0100"
69
+ },
70
+ "reference" : 6002468911013227569
71
+ },
72
+ {
73
+ "name" : "Don't Get Done, Get Dom",
74
+ "channel" : {
75
+ "name" : "bbcone",
76
+ "display_name" : "BBC One"
77
+ },
78
+ "uuid" : "b6bd69a5-bce9-4d47-b84a-0f6aec376465",
79
+ "description" : "12/20. Second-Hand Cars: Dom helps two people who have had problems with the same used car firm. Also in HD. [AD,S]",
80
+ "tags" : [],
81
+ "key" : "1-1397666142-a0db7b01836077cac16d36b79f237e33",
82
+ "timing" : {
83
+ "duration" : 2700,
84
+ "start" : "2014-04-15 11:00:00 +0100"
85
+ },
86
+ "reference" : 6002457314601528368
87
+ },
88
+ {
89
+ "name" : "Homes Under the Hammer",
90
+ "channel" : {
91
+ "name" : "bbcone",
92
+ "display_name" : "BBC One"
93
+ },
94
+ "uuid" : "208c76d5-9746-4b55-9df7-f1095f6f1550",
95
+ "description" : "Martin Roberts and Lucy Alexander visit a renovation project in Maidstone, a one-bedroom flat in Salford and a house in Stoke with an outside toilet. [S]",
96
+ "tags" : [],
97
+ "key" : "1-1397666142-70ea4d07c926321bffb402537d15487a",
98
+ "timing" : {
99
+ "duration" : 3600,
100
+ "start" : "2014-04-15 10:00:00 +0100"
101
+ },
102
+ "reference" : 6002441852719262767
103
+ },
104
+ {
105
+ "name" : "Homes Under the Hammer",
106
+ "channel" : {
107
+ "name" : "bbcone",
108
+ "display_name" : "BBC One"
109
+ },
110
+ "uuid" : "b49c3134-0503-4cb9-a34b-30b897b85b75",
111
+ "description" : "Martin Roberts and Lucy Alexander visit a renovation project in Maidstone, a one-bedroom flat in Salford and a house in Stoke with an outside toilet. [S]",
112
+ "tags" : [],
113
+ "key" : "1-1397666142-70ea4d07c926321bffb402537d15487a",
114
+ "timing" : {
115
+ "duration" : 3600,
116
+ "start" : "2014-04-15 10:00:00 +0100"
117
+ },
118
+ "reference" : 6002441852719262767
119
+ },
120
+ {
121
+ "name" : "Helicopter Heroes: New Cases",
122
+ "channel" : {
123
+ "name" : "bbcone",
124
+ "display_name" : "BBC One"
125
+ },
126
+ "uuid" : "9bc480dd-1aa5-4691-9232-eb15e5c591db",
127
+ "description" : "Series following the Yorkshire Air Ambulance. An eight-year-old boy is stabbed and the helimed team must save him. Meanwhile, a DIY enthusiast's dream home almost kills him. Also in HD. [AD,S]",
128
+ "tags" : [],
129
+ "key" : "1-1397666142-46f6ffef86e3739bfbff302fcd1ce666",
130
+ "timing" : {
131
+ "duration" : 2700,
132
+ "start" : "2014-04-15 09:15:00 +0100"
133
+ },
134
+ "reference" : 6002430256307566003
135
+ },
136
+ {
137
+ "name" : "Breakfast",
138
+ "channel" : {
139
+ "name" : "bbcone",
140
+ "display_name" : "BBC One"
141
+ },
142
+ "uuid" : "245bca49-1595-4d6d-bdb2-9b737018adc5",
143
+ "description" : "The latest news, sport, business and weather from the BBC's Breakfast team. Also in HD. [S] Including regional news at 25 and 55 minutes past each hour.",
144
+ "tags" : [],
145
+ "key" : "1-1397666142-d092e33e62085fc099c2b704c5f7ee11",
146
+ "timing" : {
147
+ "duration" : 11700,
148
+ "start" : "2014-04-15 06:00:00 +0100"
149
+ },
150
+ "reference" : 6002380005190200365
151
+ },
152
+ {
153
+ "name" : "Breakfast",
154
+ "channel" : {
155
+ "name" : "bbcone",
156
+ "display_name" : "BBC One"
157
+ },
158
+ "uuid" : "279e9823-c335-46bf-a39e-b015487886e2",
159
+ "description" : "The latest news, sport, business and weather from the BBC's Breakfast team. Also in HD. [S] Including regional news at 25 and 55 minutes past each hour.",
160
+ "tags" : [],
161
+ "key" : "1-1397666142-d092e33e62085fc099c2b704c5f7ee11",
162
+ "timing" : {
163
+ "duration" : 11700,
164
+ "start" : "2014-04-15 06:00:00 +0100"
165
+ },
166
+ "reference" : 6002380005190200365
167
+ }
168
+ ]
169
+ },
170
+ "offset" : "10"
171
+ }
172
+
@@ -0,0 +1,22 @@
1
+ {
2
+ "created": "2008-01-01 01:01:01 +0000",
3
+ "can_invite": false,
4
+ "permitted_services": [
5
+ "uk.bbc.radio",
6
+ "uk.bbc.tv"
7
+ ],
8
+ "legal": {
9
+ "legal_html": "<h1>Action Required</h1>",
10
+ "accepted": 0
11
+ },
12
+ "id": 1234,
13
+ "details": {
14
+ "email": "mail@example.com",
15
+ "department": "My Department",
16
+ "division": "My Division",
17
+ "name": "Jane Smith",
18
+ "username": "jsmith"
19
+ },
20
+ "uuid": "eac522fe-313a-453e-97b0-d33e6fd50c62"
21
+ }
22
+
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+
3
+ describe BBC::Redux do
4
+
5
+ let(:username) { @username ||= ask('Please enter redux user: ') }
6
+ let(:password) { @password ||= ask('Please enter redux pass: ', true) }
7
+
8
+ it 'should work' do
9
+
10
+ client = BBC::Redux::Client.new({
11
+ :username => username, :password => password,
12
+ })
13
+
14
+ # Test Asset
15
+ asset = client.asset('5966413090093319525')
16
+
17
+ expect(asset.channel.class).to eq(BBC::Redux::Channel)
18
+ expect(asset.channel.display_name).to eq('CBeebies')
19
+ expect(asset.channel.name).to eq('cbeebies')
20
+
21
+ expect(asset.description).to eq('Pingu\'s Moon Adventure: Animated ' +
22
+ 'adventures of Pingu, the clumsy young penguin. Pingu wants to visit' +
23
+ ' the moon so he makes a rocket out of an old barrel, tin foil and' +
24
+ ' snow. [S]')
25
+
26
+ expect(asset.disk_reference).to eq('5966413090093319525')
27
+ expect(asset.duration).to eq(300)
28
+ expect(asset.key.class).to eq(BBC::Redux::Key)
29
+ expect(asset.name).to eq('Pingu')
30
+ expect(asset.start).to eq(DateTime.parse('2014-01-08 06:50:00 +0000'))
31
+ expect(asset.uuid).to eq('26a141fc-8511-4fef-aa2b-af1d1de5a75a')
32
+
33
+ # Test media url
34
+ resp = client.http.head(asset.flv_url)
35
+ expect(resp.code).to eq(200)
36
+
37
+ # Test channels
38
+ channels = client.channels
39
+
40
+ expect(channels.first.class).to eq(BBC::Redux::Channel)
41
+
42
+ # Test search
43
+ results = client.search(:limit => 100, :channel => [ 'bbcone', 'bbctwo' ])
44
+
45
+ ones = results.assets.select {|a| a.channel.name == 'bbcone' }
46
+ twos = results.assets.select {|a| a.channel.name == 'bbctwo' }
47
+
48
+ # Channel array query thing works
49
+ expect(ones.size > 0).to eq(true)
50
+ expect(twos.size > 0).to eq(true)
51
+ expect(ones.size + twos.size).to eq(results.assets.size)
52
+
53
+ # Test channel_categories
54
+ categories = client.channel_categories
55
+
56
+ expect(categories.first.class).to eq(BBC::Redux::ChannelCategory)
57
+
58
+ # Test user
59
+ user = client.user
60
+
61
+ expect(user.username).to eq(username)
62
+ expect(user.class).to eq(BBC::Redux::User)
63
+
64
+ # Test logout
65
+ expect(client.logout).to be(nil)
66
+ end
67
+
68
+ private
69
+
70
+ def ask(question, quietly = false)
71
+ print question
72
+ system 'stty -echo' if quietly
73
+ answer = $stdin.gets.chomp
74
+ system 'stty echo' if quietly
75
+ return answer
76
+ end
77
+
78
+ end
@@ -0,0 +1,24 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.start do
4
+ add_filter '/spec/'
5
+ end
6
+
7
+ $: << File.join( File.dirname(__FILE__), '..', 'lib' )
8
+
9
+ require 'rspec'
10
+ require 'rspec/its'
11
+ require 'bbc/redux'
12
+
13
+ RSpec.configure do |config|
14
+ config.order = 'random'
15
+
16
+ config.mock_with :rspec do |c|
17
+ c.syntax = [:should, :expect]
18
+ end
19
+
20
+ def read_fixture(fname)
21
+ File.read File.join( File.dirname(__FILE__), 'fixtures', fname )
22
+ end
23
+
24
+ end