bigbluebutton_rails 0.0.5 → 0.0.6
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.
- data/.gitignore +2 -0
- data/.rvmrc +6 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.rdoc +9 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +85 -65
- data/README.rdoc +23 -0
- data/Rakefile +17 -6
- data/app/controllers/bigbluebutton/rooms_controller.rb +79 -58
- data/app/controllers/bigbluebutton/servers_controller.rb +41 -24
- data/app/models/bigbluebutton_room.rb +45 -5
- data/app/models/bigbluebutton_server.rb +5 -7
- data/app/views/bigbluebutton/rooms/external.html.erb +24 -0
- data/app/views/bigbluebutton/rooms/join_mobile.html.erb +1 -1
- data/app/views/bigbluebutton/servers/_activity_list.html.erb +7 -7
- data/app/views/bigbluebutton/servers/activity.html.erb +1 -1
- data/bigbluebutton_rails.gemspec +2 -12
- data/config/locales/en.yml +3 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +12 -6
- data/lib/bigbluebutton_rails/utils.rb +8 -0
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/bigbluebutton_rails.rb +1 -0
- data/spec/bigbluebutton_rails_spec.rb +13 -0
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +114 -0
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +167 -0
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +213 -457
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +148 -0
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +50 -76
- data/spec/factories/bigbluebutton_room.rb +1 -0
- data/spec/models/bigbluebutton_room_spec.rb +141 -17
- data/spec/models/bigbluebutton_server_spec.rb +27 -36
- data/spec/rails_app/app/controllers/application_controller.rb +4 -3
- data/spec/rails_app/config/initializers/rack_hotfix.rb +13 -0
- data/spec/rails_app/features/join_external_bigbluebutton_rooms.feature +19 -0
- data/spec/rails_app/features/manage_bigbluebutton_rooms.feature +3 -3
- data/spec/rails_app/features/manage_bigbluebutton_servers.feature +2 -2
- data/spec/rails_app/features/step_definitions/bigbluebutton_room_steps.rb +29 -3
- data/spec/rails_app/features/step_definitions/bigbluebutton_server_steps.rb +2 -7
- data/spec/rails_app/features/step_definitions/common_steps.rb +15 -2
- data/spec/rails_app/features/step_definitions/web_steps.rb +7 -3
- data/spec/rails_app/features/support/application_controller.rb +12 -0
- data/spec/rails_app/features/support/content.rb +10 -0
- data/spec/rails_app/features/support/env.rb +4 -4
- data/spec/rails_app/features/support/env_gem.rb +2 -1
- data/spec/rails_app/features/support/forms.rb +12 -0
- data/spec/rails_app/features/support/paths.rb +17 -8
- data/spec/rails_app/features/support/selectors.rb +57 -0
- data/spec/rails_app/features/support/within.rb +7 -0
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +60 -52
- data/spec/routing/bigbluebutton/servers_routing_spec.rb +8 -8
- data/spec/spec_helper.rb +5 -0
- data/spec/support/controllers/bigbluebutton/rooms_controller.rb +7 -0
- data/spec/support/matchers/shoulda/be_boolean.rb +1 -1
- data/spec/support/shared_examples/rooms_controller.rb +37 -0
- metadata +24 -110
- data/spec/rails_app/app/helpers/application_helper.rb +0 -2
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bigbluebutton::RoomsController do
|
4
|
+
render_views
|
5
|
+
let(:server) { Factory.create(:bigbluebutton_server) }
|
6
|
+
let(:room) { Factory.create(:bigbluebutton_room, :server => server) }
|
7
|
+
|
8
|
+
context "json responses for " do
|
9
|
+
|
10
|
+
describe "#index" do
|
11
|
+
before do
|
12
|
+
@room1 = Factory.create(:bigbluebutton_room, :server => server)
|
13
|
+
@room2 = Factory.create(:bigbluebutton_room, :server => server)
|
14
|
+
end
|
15
|
+
before(:each) { get :index, :server_id => server.to_param, :format => 'json' }
|
16
|
+
it { should respond_with(:success) }
|
17
|
+
it { should respond_with_content_type(:json) }
|
18
|
+
it { should respond_with_json([@room1, @room2].to_json) }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#new" do
|
22
|
+
before(:each) { get :new, :server_id => server.to_param, :format => 'json' }
|
23
|
+
it { should respond_with(:success) }
|
24
|
+
it { should respond_with_content_type(:json) }
|
25
|
+
it {
|
26
|
+
# we ignore all values bc a BigbluebuttonRoom is generated with some
|
27
|
+
# random values (meetingid, voice_bridge)
|
28
|
+
should respond_with_json(BigbluebuttonRoom.new.to_json).ignoring_values
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#show" do
|
33
|
+
before(:each) { get :show, :server_id => server.to_param, :id => room.to_param, :format => 'json' }
|
34
|
+
it { should respond_with(:success) }
|
35
|
+
it { should respond_with_content_type(:json) }
|
36
|
+
it { should respond_with_json(room.to_json) }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#create" do
|
40
|
+
let(:new_room) { Factory.build(:bigbluebutton_room, :server => server) }
|
41
|
+
|
42
|
+
context "on success" do
|
43
|
+
before(:each) {
|
44
|
+
post :create, :server_id => server.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
45
|
+
}
|
46
|
+
it { should respond_with(:created) }
|
47
|
+
it { should respond_with_content_type(:json) }
|
48
|
+
it {
|
49
|
+
json = { :message => I18n.t('bigbluebutton_rails.rooms.notice.create.success') }.to_json
|
50
|
+
should respond_with_json(json)
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
context "on failure" do
|
55
|
+
before(:each) {
|
56
|
+
new_room.name = nil # invalid
|
57
|
+
post :create, :server_id => server.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
58
|
+
}
|
59
|
+
it { should respond_with(:unprocessable_entity) }
|
60
|
+
it { should respond_with_content_type(:json) }
|
61
|
+
it {
|
62
|
+
new_room.save # should fail
|
63
|
+
should respond_with_json(new_room.errors.full_messages.to_json)
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#update" do
|
69
|
+
let(:new_room) { Factory.build(:bigbluebutton_room) }
|
70
|
+
before { @room = room }
|
71
|
+
|
72
|
+
context "on success" do
|
73
|
+
before(:each) {
|
74
|
+
put :update, :server_id => server.to_param, :id => @room.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
75
|
+
}
|
76
|
+
it { should respond_with(:success) }
|
77
|
+
it { should respond_with_content_type(:json) }
|
78
|
+
it {
|
79
|
+
json = { :message => I18n.t('bigbluebutton_rails.rooms.notice.update.success') }.to_json
|
80
|
+
should respond_with_json(json)
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
context "on failure" do
|
85
|
+
before(:each) {
|
86
|
+
new_room.name = nil # invalid
|
87
|
+
put :update, :server_id => server.to_param, :id => @room.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
88
|
+
}
|
89
|
+
it { should respond_with(:unprocessable_entity) }
|
90
|
+
it { should respond_with_content_type(:json) }
|
91
|
+
it {
|
92
|
+
new_room.save # should fail
|
93
|
+
should respond_with_json(new_room.errors.full_messages.to_json)
|
94
|
+
}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "#end" do
|
99
|
+
before { mock_server_and_api }
|
100
|
+
|
101
|
+
context "room is running" do
|
102
|
+
before {
|
103
|
+
mocked_api.should_receive(:is_meeting_running?).and_return(true)
|
104
|
+
mocked_api.should_receive(:end_meeting).with(room.meetingid, room.moderator_password)
|
105
|
+
}
|
106
|
+
before(:each) { get :end, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json' }
|
107
|
+
it { should respond_with(:success) }
|
108
|
+
it { should respond_with_content_type(:json) }
|
109
|
+
it { should respond_with_json(I18n.t('bigbluebutton_rails.rooms.notice.end.success')) }
|
110
|
+
end
|
111
|
+
|
112
|
+
context "room is not running" do
|
113
|
+
before { mocked_api.should_receive(:is_meeting_running?).and_return(false) }
|
114
|
+
before(:each) { get :end, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json' }
|
115
|
+
it { should respond_with(:error) }
|
116
|
+
it { should respond_with_content_type(:json) }
|
117
|
+
it { should respond_with_json(I18n.t('bigbluebutton_rails.rooms.notice.end.not_running')) }
|
118
|
+
end
|
119
|
+
|
120
|
+
context "throwing an exception" do
|
121
|
+
let(:msg) { "any error message" }
|
122
|
+
before {
|
123
|
+
mocked_api.should_receive(:is_meeting_running?).and_return{ raise BigBlueButton::BigBlueButtonException.new(msg) }
|
124
|
+
}
|
125
|
+
before(:each) { get :end, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json' }
|
126
|
+
it { should respond_with(:error) }
|
127
|
+
it { should respond_with_content_type(:json) }
|
128
|
+
it { should respond_with_json(msg) }
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
describe "#destroy" do
|
134
|
+
before { mock_server_and_api }
|
135
|
+
|
136
|
+
context "on success" do
|
137
|
+
before {
|
138
|
+
mocked_api.should_receive(:is_meeting_running?).and_return(true)
|
139
|
+
mocked_api.should_receive(:end_meeting)
|
140
|
+
}
|
141
|
+
before(:each) {
|
142
|
+
delete :destroy, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json'
|
143
|
+
}
|
144
|
+
it { should respond_with(:success) }
|
145
|
+
it { should respond_with_content_type(:json) }
|
146
|
+
it {
|
147
|
+
json = { :message => I18n.t('bigbluebutton_rails.rooms.notice.destroy.success') }.to_json
|
148
|
+
should respond_with_json(json)
|
149
|
+
}
|
150
|
+
end
|
151
|
+
|
152
|
+
context "throwing error" do
|
153
|
+
let(:msg) { "any error message" }
|
154
|
+
before {
|
155
|
+
mocked_api.should_receive(:is_meeting_running?).and_return{ raise BigBlueButton::BigBlueButtonException.new(msg) }
|
156
|
+
}
|
157
|
+
before(:each) {
|
158
|
+
delete :destroy, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json'
|
159
|
+
}
|
160
|
+
it { should respond_with(:error) }
|
161
|
+
it { should respond_with_content_type(:json) }
|
162
|
+
it { should respond_with_json({ :message => msg }.to_json) }
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
end
|