bit_player 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/bit_player/navigator.rb +4 -2
- data/lib/bit_player/version.rb +1 -1
- data/spec/dummy/config/database.yml +30 -14
- data/spec/models/bit_player/navigator_spec.rb +48 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc06cd2696c212003de66e9ba194627ca77a6af9
|
4
|
+
data.tar.gz: beea1e487fd23333f326465a94cbcee8fde0b865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55aff1e7c90d479885f9ee6480294f71654f29d2f1c8087a900c4b735d8c74757dced988da32f258d57e5bdf44042a608f20cebd44b8fb96c282871e2dfb0589
|
7
|
+
data.tar.gz: b6ebd9245cc6187473c3250f717f986bf78a4249ea31a749c7c22095f440469173bd0de373dc44c4fe754df42158fbc33d7e07cc4d9a924aa7b76d9a6748d3f5
|
@@ -45,9 +45,11 @@ module BitPlayer
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def fetch_next_content
|
48
|
-
if
|
48
|
+
if content_position &&
|
49
|
+
current_content_provider.exists?(content_position + 1)
|
49
50
|
@status.increment_content_position
|
50
|
-
elsif
|
51
|
+
elsif provider_position &&
|
52
|
+
current_module.provider_exists?(provider_position + 1)
|
51
53
|
@status.increment_provider_position
|
52
54
|
else
|
53
55
|
initialize_context(context)
|
data/lib/bit_player/version.rb
CHANGED
@@ -14,13 +14,16 @@
|
|
14
14
|
# Configure Using Gemfile
|
15
15
|
# gem 'pg'
|
16
16
|
#
|
17
|
-
|
17
|
+
default: &default
|
18
18
|
adapter: postgresql
|
19
19
|
encoding: unicode
|
20
|
-
|
20
|
+
# For details on connection pooling, see rails configuration guide
|
21
|
+
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
21
22
|
pool: 5
|
22
|
-
|
23
|
-
|
23
|
+
|
24
|
+
development:
|
25
|
+
<<: *default
|
26
|
+
database: dummy_development
|
24
27
|
|
25
28
|
# Connect on a TCP socket. Omitted by default since the client uses a
|
26
29
|
# domain socket that doesn't need configuration. Windows does not have
|
@@ -44,17 +47,30 @@ development:
|
|
44
47
|
# re-generated from your development database when you run "rake".
|
45
48
|
# Do not set this db to the same as development or production.
|
46
49
|
test:
|
47
|
-
|
48
|
-
encoding: unicode
|
50
|
+
<<: *default
|
49
51
|
database: dummy_test
|
50
|
-
pool: 5
|
51
|
-
username: postgres
|
52
|
-
password:
|
53
52
|
|
53
|
+
# As with config/secrets.yml, you never want to store sensitive information,
|
54
|
+
# like your database password, in your source code. If your source code is
|
55
|
+
# ever seen by anyone, they now have access to your database.
|
56
|
+
#
|
57
|
+
# Instead, provide the password as a unix environment variable when you boot
|
58
|
+
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
59
|
+
# for a full rundown on how to provide these environment variables in a
|
60
|
+
# production deployment.
|
61
|
+
#
|
62
|
+
# On Heroku and other platform providers, you may have a full connection URL
|
63
|
+
# available as an environment variable. For example:
|
64
|
+
#
|
65
|
+
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
66
|
+
#
|
67
|
+
# You can use this database configuration with:
|
68
|
+
#
|
69
|
+
# production:
|
70
|
+
# url: <%= ENV['DATABASE_URL'] %>
|
71
|
+
#
|
54
72
|
production:
|
55
|
-
|
56
|
-
encoding: unicode
|
73
|
+
<<: *default
|
57
74
|
database: dummy_production
|
58
|
-
|
59
|
-
|
60
|
-
password:
|
75
|
+
username: dummy
|
76
|
+
password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
|
@@ -2,32 +2,61 @@ require "spec_helper"
|
|
2
2
|
require "bit_core"
|
3
3
|
|
4
4
|
describe BitPlayer::Navigator do
|
5
|
-
let(:status) do
|
6
|
-
double(
|
7
|
-
"status",
|
8
|
-
context: "a",
|
9
|
-
module_position: 1,
|
10
|
-
provider_position: 2,
|
11
|
-
content_position: 3
|
12
|
-
)
|
13
|
-
end
|
14
5
|
let(:arm) { double("arm") }
|
15
6
|
let(:group) { double("group", arm: arm) }
|
16
|
-
let(:participant) do
|
17
|
-
double("participant", navigation_status: status, active_group: group)
|
18
|
-
end
|
19
|
-
let(:view_context) { double("context", current_participant: participant) }
|
20
7
|
let(:provider) { double("provider") }
|
21
|
-
let(:nav) { BitPlayer::Navigator.new(participant) }
|
22
|
-
|
23
|
-
before do
|
24
|
-
allow(arm).to receive_message_chain(:bit_core_tools, :find_by_title)
|
25
|
-
.and_return(double("tool", id: 1))
|
26
|
-
end
|
27
8
|
|
28
9
|
describe "#render_current_content" do
|
10
|
+
let(:status) do
|
11
|
+
double(
|
12
|
+
"status",
|
13
|
+
context: "a",
|
14
|
+
module_position: 1,
|
15
|
+
provider_position: 2,
|
16
|
+
content_position: 3
|
17
|
+
)
|
18
|
+
end
|
19
|
+
let(:participant) do
|
20
|
+
double("participant", navigation_status: status, active_group: group)
|
21
|
+
end
|
22
|
+
let(:view_context) { double("context", current_participant: participant) }
|
23
|
+
let(:nav) { BitPlayer::Navigator.new(participant) }
|
24
|
+
|
25
|
+
before do
|
26
|
+
allow(arm).to receive_message_chain(:bit_core_tools, :find_by_title)
|
27
|
+
.and_return(double("tool", id: 1))
|
28
|
+
end
|
29
|
+
|
29
30
|
it "should render the content from the current provider" do
|
30
31
|
expect(nav.render_current_content(view_context)).to match(/Oops/)
|
31
32
|
end
|
32
33
|
end
|
34
|
+
|
35
|
+
describe "#fetch_next_content" do
|
36
|
+
let(:status) do
|
37
|
+
double(
|
38
|
+
"status",
|
39
|
+
context: "a",
|
40
|
+
module_position: 1,
|
41
|
+
provider_position: nil,
|
42
|
+
content_position: nil
|
43
|
+
)
|
44
|
+
end
|
45
|
+
let(:participant) do
|
46
|
+
double("participant", navigation_status: status, active_group: group)
|
47
|
+
end
|
48
|
+
let(:view_context) { double("context", current_participant: participant) }
|
49
|
+
let(:nav) { BitPlayer::Navigator.new(participant) }
|
50
|
+
|
51
|
+
before do
|
52
|
+
allow(arm).to receive_message_chain(:bit_core_tools, :find_by_title)
|
53
|
+
.and_return(double("tool", id: 1))
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should initialize context if content_position and "\
|
57
|
+
"provider_position is nil" do
|
58
|
+
expect(status).to receive(:initialize_context)
|
59
|
+
nav.fetch_next_content
|
60
|
+
end
|
61
|
+
end
|
33
62
|
end
|