bigbluebutton_rails 0.0.4 → 0.0.5

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.
Files changed (74) hide show
  1. data/.gitignore +2 -1
  2. data/CHANGELOG.rdoc +12 -0
  3. data/Gemfile.lock +53 -14
  4. data/README.rdoc +31 -29
  5. data/Rakefile +63 -11
  6. data/app/controllers/bigbluebutton/rooms_controller.rb +89 -26
  7. data/app/controllers/bigbluebutton/servers_controller.rb +38 -5
  8. data/app/helpers/bigbluebutton_rails_helper.rb +12 -0
  9. data/app/models/bigbluebutton_room.rb +44 -1
  10. data/app/models/bigbluebutton_server.rb +48 -12
  11. data/app/views/bigbluebutton/rooms/_form.html.erb +8 -0
  12. data/app/views/bigbluebutton/rooms/index.html.erb +34 -43
  13. data/app/views/bigbluebutton/rooms/join_mobile.html.erb +9 -0
  14. data/app/views/bigbluebutton/rooms/show.html.erb +8 -0
  15. data/app/views/bigbluebutton/servers/_activity_list.html.erb +48 -0
  16. data/app/views/bigbluebutton/servers/_form.html.erb +4 -0
  17. data/app/views/bigbluebutton/servers/activity.html.erb +51 -0
  18. data/app/views/bigbluebutton/servers/index.html.erb +21 -25
  19. data/app/views/bigbluebutton/servers/show.html.erb +5 -0
  20. data/bigbluebutton_rails.gemspec +9 -6
  21. data/config/locales/en.yml +11 -2
  22. data/lib/bigbluebutton_rails/controller_methods.rb +47 -14
  23. data/lib/bigbluebutton_rails/exceptions.rb +6 -0
  24. data/lib/bigbluebutton_rails/rails/routes.rb +17 -12
  25. data/lib/bigbluebutton_rails/rails.rb +4 -0
  26. data/lib/bigbluebutton_rails/version.rb +1 -1
  27. data/lib/bigbluebutton_rails.rb +1 -0
  28. data/lib/generators/bigbluebutton_rails/install_generator.rb +28 -5
  29. data/lib/generators/bigbluebutton_rails/templates/migration.rb +3 -0
  30. data/lib/generators/bigbluebutton_rails/templates/migration_0_0_4.rb +38 -0
  31. data/lib/generators/bigbluebutton_rails/templates/migration_0_0_5.rb +23 -0
  32. data/{lib/generators/bigbluebutton_rails/templates/public → public}/images/loading.gif +0 -0
  33. data/{lib/generators/bigbluebutton_rails/templates/public → public}/javascripts/jquery.min.js +0 -0
  34. data/public/stylesheets/bigbluebutton_rails.css +138 -0
  35. data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +284 -25
  36. data/spec/controllers/bigbluebutton/servers_controller_spec.rb +93 -1
  37. data/spec/factories/bigbluebutton_room.rb +1 -0
  38. data/spec/factories/bigbluebutton_server.rb +1 -0
  39. data/spec/factories/integration/bigbluebutton_server_integration.rb +8 -0
  40. data/spec/generators/install_generator_spec.rb +53 -10
  41. data/spec/generators/views_generator_spec.rb +6 -2
  42. data/spec/helpers/bigbluebutton_rails_helper_spec.rb +19 -0
  43. data/spec/integration_conf.yml.example +5 -0
  44. data/spec/models/bigbluebutton_room_spec.rb +99 -72
  45. data/spec/models/bigbluebutton_server_spec.rb +81 -20
  46. data/spec/rails_app/.gitignore +2 -1
  47. data/spec/rails_app/app/views/layouts/application.html.erb +1 -1
  48. data/spec/rails_app/config/cucumber.yml +8 -0
  49. data/spec/rails_app/config/database.yml +4 -1
  50. data/spec/rails_app/db/seeds.rb +6 -5
  51. data/spec/rails_app/features/manage_bigbluebutton_rooms.feature +9 -0
  52. data/spec/rails_app/features/manage_bigbluebutton_servers.feature +9 -0
  53. data/spec/rails_app/features/step_definitions/bigbluebutton_room_steps.rb +38 -0
  54. data/spec/rails_app/features/step_definitions/bigbluebutton_server_steps.rb +23 -0
  55. data/spec/rails_app/features/step_definitions/common_steps.rb +3 -0
  56. data/spec/rails_app/features/step_definitions/web_steps.rb +211 -0
  57. data/spec/rails_app/features/support/content.rb +11 -0
  58. data/spec/rails_app/features/support/env.rb +50 -0
  59. data/spec/rails_app/features/support/env_gem.rb +9 -0
  60. data/spec/rails_app/features/support/paths.rb +38 -0
  61. data/spec/rails_app/features/support/selectors.rb +39 -0
  62. data/spec/rails_app/lib/tasks/cucumber.rake +65 -0
  63. data/spec/rails_app/public/images/loading.gif +0 -0
  64. data/spec/rails_app/public/javascripts/jquery.min.js +16 -0
  65. data/spec/rails_app/public/stylesheets/bigbluebutton_rails.css +138 -0
  66. data/spec/rails_app/script/cucumber +10 -0
  67. data/spec/routing/bigbluebutton/rooms_routing_spec.rb +12 -0
  68. data/spec/spec_helper.rb +0 -1
  69. data/spec/support/integration/integration_conf.rb +16 -0
  70. data/spec/support/matchers/shoulda/respond_with_json_matcher.rb +67 -0
  71. data/spec/support/mocked_server.rb +1 -0
  72. metadata +91 -29
  73. data/lib/generators/bigbluebutton_rails/public_generator.rb +0 -16
  74. data/spec/generators/public_generator_spec.rb +0 -31
@@ -0,0 +1,5 @@
1
+ server:
2
+ name: 'Default'
3
+ url: 'http://myserver/bigbluebutton/api'
4
+ salt: 'mysalt'
5
+ version: '0.7'
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe BigbluebuttonRoom do
@@ -21,21 +22,20 @@ describe BigbluebuttonRoom do
21
22
  it { should have_db_column(:max_participants).of_type(:integer) }
22
23
  it { should have_db_column(:private).of_type(:boolean) }
23
24
  it { should have_db_column(:randomize_meetingid).of_type(:boolean) }
25
+ it { should have_db_column(:external).of_type(:boolean) }
26
+ it { should have_db_column(:param).of_type(:string) }
24
27
  it { should have_db_index(:server_id) }
25
28
  it { should have_db_index(:meetingid).unique(true) }
26
29
  it { should have_db_index(:voice_bridge).unique(true) }
27
- it {
30
+ it "default values" do
28
31
  room = BigbluebuttonRoom.new
29
32
  room.private.should be_false
30
- }
31
- it {
32
- room = BigbluebuttonRoom.new
33
33
  room.randomize_meetingid.should be_true
34
- }
34
+ room.external.should be_false
35
+ end
35
36
  end
36
37
 
37
38
  context do
38
-
39
39
  before { Factory.create(:bigbluebutton_room) }
40
40
 
41
41
  it { should belong_to(:server) }
@@ -47,13 +47,15 @@ describe BigbluebuttonRoom do
47
47
  it { should validate_presence_of(:meetingid) }
48
48
  it { should validate_presence_of(:voice_bridge) }
49
49
  it { should validate_presence_of(:name) }
50
+ it { should validate_presence_of(:param) }
50
51
 
51
52
  it { should be_boolean(:private) }
52
53
  it { should be_boolean(:randomize_meetingid) }
53
54
 
54
55
  [:name, :server_id, :meetingid, :attendee_password, :moderator_password,
55
56
  :welcome_msg, :owner, :server, :private, :logout_url, :dial_number,
56
- :voice_bridge, :max_participants, :owner_id, :owner_type, :randomize_meetingid].
57
+ :voice_bridge, :max_participants, :owner_id, :owner_type,
58
+ :randomize_meetingid, :param].
57
59
  each do |attribute|
58
60
  it { should allow_mass_assignment_of(attribute) }
59
61
  end
@@ -62,6 +64,7 @@ describe BigbluebuttonRoom do
62
64
  it { should validate_uniqueness_of(:meetingid) }
63
65
  it { should validate_uniqueness_of(:name) }
64
66
  it { should validate_uniqueness_of(:voice_bridge) }
67
+ it { should validate_uniqueness_of(:param) }
65
68
 
66
69
  it {
67
70
  room = Factory.create(:bigbluebutton_room)
@@ -73,14 +76,23 @@ describe BigbluebuttonRoom do
73
76
  it { should ensure_length_of(:attendee_password).is_at_most(16) }
74
77
  it { should ensure_length_of(:moderator_password).is_at_most(16) }
75
78
  it { should ensure_length_of(:welcome_msg).is_at_most(250) }
79
+ it { should ensure_length_of(:param).is_at_least(3) }
76
80
 
77
81
  # attr_accessors
78
82
  [:running, :participant_count, :moderator_count, :attendees,
79
- :has_been_forcibly_ended, :start_time, :end_time].each do |attr|
83
+ :has_been_forcibly_ended, :start_time, :end_time, :external].each do |attr|
80
84
  it { should respond_to(attr) }
81
85
  it { should respond_to("#{attr}=") }
82
86
  end
83
87
 
88
+ context ".to_param" do
89
+ it { should respond_to(:to_param) }
90
+ it {
91
+ r = Factory.create(:bigbluebutton_room)
92
+ r.to_param.should be(r.param)
93
+ }
94
+ end
95
+
84
96
  it { should respond_to(:is_running?) }
85
97
 
86
98
  describe "#user_role" do
@@ -93,6 +105,42 @@ describe BigbluebuttonRoom do
93
105
  it { room.user_role({ :not_password => "any" }).should == nil }
94
106
  end
95
107
 
108
+ describe "#instance_variables_compare" do
109
+ let(:room) { Factory.create(:bigbluebutton_room) }
110
+ let(:room2) { BigbluebuttonRoom.last }
111
+ it { should respond_to(:instance_variables_compare) }
112
+ it { room.instance_variables_compare(room2).should be_empty }
113
+ it "compares instance variables" do
114
+ room2.running = !room.running
115
+ room.instance_variables_compare(room2).should_not be_empty
116
+ room.instance_variables_compare(room2).should include(:@running)
117
+ end
118
+ it "ignores attributes" do
119
+ room2.private = !room.private
120
+ room.instance_variables_compare(room2).should be_empty
121
+ end
122
+ end
123
+
124
+ describe "#attr_equal?" do
125
+ before { Factory.create(:bigbluebutton_room) }
126
+ let(:room) { BigbluebuttonRoom.last }
127
+ let(:room2) { BigbluebuttonRoom.last }
128
+ it { should respond_to(:attr_equal?) }
129
+ it { room.attr_equal?(room2).should be_true }
130
+ it "compares instance variables" do
131
+ room2.running = !room.running
132
+ room.attr_equal?(room2).should be_false
133
+ end
134
+ it "compares attributes" do
135
+ room2.private = !room.private
136
+ room.attr_equal?(room2).should be_false
137
+ end
138
+ it "compares objects" do
139
+ room2 = room.clone
140
+ room.attr_equal?(room2).should be_false
141
+ end
142
+ end
143
+
96
144
  context "initializes" do
97
145
  let(:room) { BigbluebuttonRoom.new }
98
146
 
@@ -125,63 +173,38 @@ describe BigbluebuttonRoom do
125
173
  end
126
174
  end
127
175
 
176
+ context "param format" do
177
+ let(:msg) { I18n.t('bigbluebutton_rails.rooms.errors.param_format') }
178
+ it { should validate_format_of(:param).not_with("123 321").with_message(msg) }
179
+ it { should validate_format_of(:param).not_with("").with_message(msg) }
180
+ it { should validate_format_of(:param).not_with("ab@c").with_message(msg) }
181
+ it { should validate_format_of(:param).not_with("ab#c").with_message(msg) }
182
+ it { should validate_format_of(:param).not_with("ab$c").with_message(msg) }
183
+ it { should validate_format_of(:param).not_with("ab%c").with_message(msg) }
184
+ it { should validate_format_of(:param).not_with("ábcd").with_message(msg) }
185
+ it { should validate_format_of(:param).not_with("-abc").with_message(msg) }
186
+ it { should validate_format_of(:param).not_with("abc-").with_message(msg) }
187
+ it { should validate_format_of(:param).with("_abc").with_message(msg) }
188
+ it { should validate_format_of(:param).with("abc_").with_message(msg) }
189
+ it { should validate_format_of(:param).with("abc") }
190
+ it { should validate_format_of(:param).with("123") }
191
+ it { should validate_format_of(:param).with("abc-123_d5") }
192
+ end
128
193
 
129
-
130
- =begin
131
- context "randomizes meetingid" do
132
- let(:fail_hash) { { :returncode => true, :meetingID => "new id",
133
- :messageKey => "duplicateWarning" } }
134
- let(:success_hash) { { :returncode => true, :meetingID => "new id",
135
- :messageKey => "" } }
136
- let(:new_id) { "new id" }
137
- before {
138
- room.randomize_meetingid = true
139
- room.server = mocked_server
140
- }
141
-
142
- it "before calling create" do
143
- room.should_receive(:random_meetingid).and_return(new_id)
144
- mocked_api.should_receive(:create_meeting).
145
- with(room.name, new_id, room.moderator_password,
146
- room.attendee_password, room.welcome_msg, room.dial_number,
147
- room.logout_url, room.max_participants, room.voice_bridge)
148
- room.send_create
149
- end
150
-
151
- it "and tries again on error" do
152
- # fails twice and them succeds
153
- room.should_receive(:random_meetingid).exactly(3).times.and_return(new_id)
154
- mocked_api.should_receive(:create_meeting).
155
- with(room.name, new_id, room.moderator_password,
156
- room.attendee_password, room.welcome_msg, room.dial_number,
157
- room.logout_url, room.max_participants, room.voice_bridge).
158
- twice.
159
- and_return(fail_hash)
160
- mocked_api.should_receive(:create_meeting).
161
- with(room.name, new_id, room.moderator_password,
162
- room.attendee_password, room.welcome_msg, room.dial_number,
163
- room.logout_url, room.max_participants, room.voice_bridge).
164
- once.
165
- and_return(success_hash)
166
- room.send_create
167
- end
168
-
169
- it "and limits to 10 tries" do
170
- room.should_receive(:random_meetingid).exactly(11).times.and_return(new_id)
171
- mocked_api.should_receive(:create_meeting).
172
- with(room.name, new_id, room.moderator_password,
173
- room.attendee_password, room.welcome_msg, room.dial_number,
174
- room.logout_url, room.max_participants, room.voice_bridge).
175
- exactly(10).times.
176
- and_return(fail_hash)
177
- room.send_create
178
- end
179
- end
180
-
194
+ context "sets param as the downcased parameterized name if param is" do
195
+ after :each do
196
+ @room.save.should be_true
197
+ @room.param.should == @room.name.downcase.parameterize
181
198
  end
182
- =end
183
-
184
-
199
+ it "nil" do
200
+ @room = Factory.build(:bigbluebutton_room, :param => nil,
201
+ :name => "-My Name@ _Is Odd_-")
202
+ end
203
+ it "empty" do
204
+ @room = Factory.build(:bigbluebutton_room, :param => "",
205
+ :name => "-My Name@ _Is Odd_-")
206
+ end
207
+ end
185
208
 
186
209
  context "using the api" do
187
210
  before { mock_server_and_api }
@@ -298,15 +321,6 @@ describe BigbluebuttonRoom do
298
321
 
299
322
  it { should respond_to(:send_create) }
300
323
 
301
- it "send create_meeting" do
302
- mocked_api.should_receive(:create_meeting).
303
- with(room.name, room.meetingid, room.moderator_password,
304
- room.attendee_password, room.welcome_msg, room.dial_number,
305
- room.logout_url, room.max_participants, room.voice_bridge)
306
- room.server = mocked_server
307
- room.send_create
308
- end
309
-
310
324
  it "send create_meeting" do
311
325
  mocked_api.should_receive(:create_meeting).
312
326
  with(room.name, room.meetingid, room.moderator_password,
@@ -395,9 +409,22 @@ describe BigbluebuttonRoom do
395
409
  room.server = mocked_server
396
410
  room.join_url(username, :attendee)
397
411
  end
412
+ end
398
413
 
414
+ end
415
+
416
+ context "validates passwords" do
417
+ context "for private rooms" do
418
+ let (:room) { Factory.build(:bigbluebutton_room, :private => true) }
419
+ it { room.should_not allow_value('').for(:moderator_password) }
420
+ it { room.should_not allow_value('').for(:attendee_password) }
399
421
  end
400
422
 
423
+ context "for public rooms" do
424
+ let (:room) { Factory.build(:bigbluebutton_room, :private => false) }
425
+ it { room.should allow_value('').for(:moderator_password) }
426
+ it { room.should allow_value('').for(:attendee_password) }
427
+ end
401
428
  end
402
429
 
403
430
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe BigbluebuttonServer do
@@ -11,6 +12,7 @@ describe BigbluebuttonServer do
11
12
  it { should have_db_column(:url).of_type(:string) }
12
13
  it { should have_db_column(:salt).of_type(:string) }
13
14
  it { should have_db_column(:version).of_type(:string) }
15
+ it { should have_db_column(:param).of_type(:string) }
14
16
  end
15
17
 
16
18
  context do
@@ -21,15 +23,20 @@ describe BigbluebuttonServer do
21
23
  it { should validate_presence_of(:url) }
22
24
  it { should validate_presence_of(:salt) }
23
25
  it { should validate_presence_of(:version) }
26
+ it { should validate_presence_of(:param) }
24
27
 
25
28
  it { should allow_mass_assignment_of(:name) }
26
29
  it { should allow_mass_assignment_of(:url) }
27
30
  it { should allow_mass_assignment_of(:salt) }
28
-
29
- it {
30
- Factory.create(:bigbluebutton_server)
31
- should validate_uniqueness_of(:url)
32
- }
31
+ it { should allow_mass_assignment_of(:version) }
32
+ it { should allow_mass_assignment_of(:param) }
33
+
34
+ context "uniqueness of" do
35
+ before(:each) { Factory.create(:bigbluebutton_server) }
36
+ it { should validate_uniqueness_of(:url) }
37
+ it { should validate_uniqueness_of(:name) }
38
+ it { should validate_uniqueness_of(:param) }
39
+ end
33
40
 
34
41
  it "has associated rooms" do
35
42
  server = Factory.create(:bigbluebutton_server)
@@ -54,17 +61,63 @@ describe BigbluebuttonServer do
54
61
  it { should ensure_length_of(:name).is_at_least(1).is_at_most(500) }
55
62
  it { should ensure_length_of(:url).is_at_most(500) }
56
63
  it { should ensure_length_of(:salt).is_at_least(1).is_at_most(500) }
64
+ it { should ensure_length_of(:param).is_at_least(3) }
65
+
66
+ context ".to_param" do
67
+ it { should respond_to(:to_param) }
68
+ it {
69
+ s = Factory.create(:bigbluebutton_server)
70
+ s.to_param.should be(s.param)
71
+ }
72
+ end
57
73
 
58
- it { should allow_value('http://demo.bigbluebutton.org/bigbluebutton/api').for(:url) }
59
- it { should_not allow_value('').for(:url) }
60
- it { should_not allow_value('http://demo.bigbluebutton.org').for(:url) }
61
- it { should_not allow_value('demo.bigbluebutton.org/bigbluebutton/api').for(:url) }
74
+ context "url format" do
75
+ it { should allow_value('http://demo.bigbluebutton.org/bigbluebutton/api').for(:url) }
76
+ it { should_not allow_value('').for(:url) }
77
+ it { should_not allow_value('http://demo.bigbluebutton.org').for(:url) }
78
+ it { should_not allow_value('demo.bigbluebutton.org/bigbluebutton/api').for(:url) }
79
+ end
62
80
 
63
- it { should allow_value('0.64').for(:version) }
64
- it { should allow_value('0.7').for(:version) }
65
- it { should_not allow_value('').for(:version) }
66
- it { should_not allow_value('0.8').for(:version) }
67
- it { should_not allow_value('0.6').for(:version) }
81
+ context "supported versions" do
82
+ it { should allow_value('0.64').for(:version) }
83
+ it { should allow_value('0.7').for(:version) }
84
+ it { should_not allow_value('').for(:version) }
85
+ it { should_not allow_value('0.8').for(:version) }
86
+ it { should_not allow_value('0.6').for(:version) }
87
+ end
88
+
89
+ context "param format" do
90
+ let(:msg) { I18n.t('bigbluebutton_rails.servers.errors.param_format') }
91
+ it { should validate_format_of(:param).not_with("123 321").with_message(msg) }
92
+ it { should validate_format_of(:param).not_with("").with_message(msg) }
93
+ it { should validate_format_of(:param).not_with("ab@c").with_message(msg) }
94
+ it { should validate_format_of(:param).not_with("ab#c").with_message(msg) }
95
+ it { should validate_format_of(:param).not_with("ab$c").with_message(msg) }
96
+ it { should validate_format_of(:param).not_with("ab%c").with_message(msg) }
97
+ it { should validate_format_of(:param).not_with("ábcd").with_message(msg) }
98
+ it { should validate_format_of(:param).not_with("-abc").with_message(msg) }
99
+ it { should validate_format_of(:param).not_with("abc-").with_message(msg) }
100
+ it { should validate_format_of(:param).with("_abc").with_message(msg) }
101
+ it { should validate_format_of(:param).with("abc_").with_message(msg) }
102
+ it { should validate_format_of(:param).with("abc") }
103
+ it { should validate_format_of(:param).with("123") }
104
+ it { should validate_format_of(:param).with("abc-123_d5") }
105
+ end
106
+
107
+ context "sets param as the downcased parameterized name if param is" do
108
+ after :each do
109
+ @server.save.should be_true
110
+ @server.param.should == @server.name.downcase.parameterize
111
+ end
112
+ it "nil" do
113
+ @server = Factory.build(:bigbluebutton_server, :param => nil,
114
+ :name => "-My Name@ _Is Odd_-")
115
+ end
116
+ it "empty" do
117
+ @server = Factory.build(:bigbluebutton_server, :param => "",
118
+ :name => "-My Name@ _Is Odd_-")
119
+ end
120
+ end
68
121
 
69
122
  context "has an api object" do
70
123
  let(:server) { server = Factory.build(:bigbluebutton_server) }
@@ -100,8 +153,8 @@ describe BigbluebuttonServer do
100
153
 
101
154
  context "fetching info from bbb" do
102
155
  let(:server) { Factory.create(:bigbluebutton_server) }
103
- let(:room1) { Factory.create(:bigbluebutton_room, :server => server, :meetingid => "room1") }
104
- let(:room2) { Factory.create(:bigbluebutton_room, :server => server, :meetingid => "room2") }
156
+ let(:room1) { Factory.create(:bigbluebutton_room, :server => server, :meetingid => "room1", :randomize_meetingid => true) }
157
+ let(:room2) { Factory.create(:bigbluebutton_room, :server => server, :meetingid => "room2", :randomize_meetingid => true) }
105
158
  before {
106
159
  @api_mock = mock(BigBlueButton::BigBlueButtonApi)
107
160
  server.stub(:api).and_return(@api_mock)
@@ -110,9 +163,9 @@ describe BigbluebuttonServer do
110
163
  # the hashes should be exactly as returned by bigbluebutton-api-ruby to be sure we are testing it right
111
164
  let(:meetings) {
112
165
  [
113
- { :meetingID => room1.meetingid, :attendeePW=>"ap", :moderatorPW=>"mp", :hasBeenForciblyEnded => false, :running => true},
114
- { :meetingID => room2.meetingid, :attendeePW=>"pass", :moderatorPW=>"pass", :hasBeenForciblyEnded => true, :running => false},
115
- { :meetingID => "im not in the db", :attendeePW=>"pass", :moderatorPW=>"pass", :hasBeenForciblyEnded => true, :running => true}
166
+ { :meetingID => room1.meetingid, :attendeePW => "ap", :moderatorPW => "mp", :hasBeenForciblyEnded => false, :running => true},
167
+ { :meetingID => room2.meetingid, :attendeePW => "pass", :moderatorPW => "pass", :hasBeenForciblyEnded => true, :running => false},
168
+ { :meetingID => "im not in the db", :attendeePW => "pass", :moderatorPW => "pass", :hasBeenForciblyEnded => true, :running => true}
116
169
  ]
117
170
  }
118
171
  let(:hash) {
@@ -134,18 +187,26 @@ describe BigbluebuttonServer do
134
187
  server.meetings[0].attendee_password.should == "ap"
135
188
  server.meetings[0].moderator_password.should == "mp"
136
189
  server.meetings[0].running.should == true
190
+ server.meetings[0].new_record?.should be_false
191
+ server.meetings[0].external.should be_false
192
+ server.meetings[0].randomize_meetingid.should be_true
137
193
 
138
194
  server.meetings[1].should == room2
139
195
  server.meetings[1].attendee_password.should == "pass"
140
196
  server.meetings[1].moderator_password.should == "pass"
141
197
  server.meetings[1].running.should == false
198
+ server.meetings[1].new_record?.should be_false
199
+ server.meetings[1].external.should be_false
200
+ server.meetings[1].randomize_meetingid.should be_true
142
201
 
143
202
  server.meetings[2].meetingid.should == "im not in the db"
144
203
  server.meetings[2].server.should == server
145
- server.meetings[2].new_record?.should be_true
146
204
  server.meetings[2].attendee_password.should == "pass"
147
205
  server.meetings[2].moderator_password.should == "pass"
148
206
  server.meetings[2].running.should == true
207
+ server.meetings[2].new_record?.should be_false
208
+ server.meetings[2].external.should be_true
209
+ server.meetings[2].randomize_meetingid.should be_false
149
210
  end
150
211
 
151
212
  end
@@ -1,3 +1,4 @@
1
1
  config/locales/bigbluebutton_rails.en.yml
2
2
  db/migrate/*bigbluebutton_rails.rb
3
- db/schema.rb
3
+ db/schema.rb
4
+ tmp/
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <title>RailsApp</title>
5
5
  <%= stylesheet_link_tag :all %>
6
- <%= javascript_include_tag :defaults %>
6
+ <%= javascript_include_tag 'application', 'jquery.min' %>
7
7
  <%= csrf_meta_tag %>
8
8
  </head>
9
9
  <body>
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -9,7 +9,7 @@ development:
9
9
  # Warning: The database defined as "test" will be erased and
10
10
  # re-generated from your development database when you run "rake".
11
11
  # Do not set this db to the same as development or production.
12
- test:
12
+ test: &test
13
13
  adapter: sqlite3
14
14
  database: db/test.sqlite3
15
15
  pool: 5
@@ -20,3 +20,6 @@ production:
20
20
  database: db/production.sqlite3
21
21
  pool: 5
22
22
  timeout: 5000
23
+
24
+ cucumber:
25
+ <<: *test
@@ -1,7 +1,8 @@
1
1
  # This file should contain all the record creation needed to seed the database with its default values.
2
2
  # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
- # Mayor.create(:name => 'Daley', :city => cities.first)
3
+
4
+ file = File.join(Rails.root, "..", "integration_conf.yml")
5
+ if File.exists? file
6
+ config = YAML.load_file(file)["server"]
7
+ BigbluebuttonServer.create!(config)
8
+ end
@@ -0,0 +1,9 @@
1
+ Feature: Manage BigBlueButton rooms
2
+ In order to held webconferences
3
+ One needs to be able to create and manage BigBlueButton rooms
4
+
5
+ Scenario: Register a new BigBlueButton room
6
+ Given a BigBlueButton server
7
+ When the user goes to the new BigBlueButton room page
8
+ And registers a new BigBlueButton room
9
+ Then he should see the information about this room
@@ -0,0 +1,9 @@
1
+ Feature: Manage BigBlueButton servers
2
+ In order to held webconferences
3
+ One needs to be able to create and manage BigBlueButton servers
4
+
5
+ Scenario: Register a new BigBlueButton server
6
+ Given a user named "test user"
7
+ When he goes to the new BigBlueButton server page
8
+ And registers a new BigBlueButton server
9
+ Then he should see the information about this server
@@ -0,0 +1,38 @@
1
+ Given /a BigBlueButton server/i do
2
+ @server = Factory.create(:bigbluebutton_server_integration)
3
+ end
4
+
5
+ And /^registers a new BigBlueButton room$/i do
6
+ attrs = Factory.attributes_for(:bigbluebutton_room, :server => @server)
7
+ fill_in("bigbluebutton_room[name]", :with => attrs[:name])
8
+ fill_in("bigbluebutton_room[meetingid]", :with => attrs[:meetingid])
9
+ check("bigbluebutton_room[randomize_meetingid]") if attrs[:randomize_meetingid]
10
+ check("bigbluebutton_room[private]") if attrs[:private]
11
+ fill_in("bigbluebutton_room[attendee_password]", :with => attrs[:attendee_password])
12
+ fill_in("bigbluebutton_room[moderator_password]", :with => attrs[:moderator_password])
13
+ fill_in("bigbluebutton_room[welcome_msg]", :with => attrs[:welcome_msg])
14
+ fill_in("bigbluebutton_room[logout_url]", :with => attrs[:logout_url])
15
+ fill_in("bigbluebutton_room[dial_number]", :with => attrs[:dial_number])
16
+ fill_in("bigbluebutton_room[max_participants]", :with => attrs[:max_participants])
17
+ check("bigbluebutton_room[external]") if attrs[:external]
18
+ fill_in("bigbluebutton_room[param]", :with => attrs[:param])
19
+ # Note: voice_bridge is generated when the BigbluebuttonRoom is created
20
+ click_button("Create")
21
+ end
22
+
23
+ Then /(?:|I ) should see the information about this room/ do
24
+ room = BigbluebuttonRoom.last
25
+ page_has_content(room.name)
26
+ page_has_content(room.meetingid)
27
+ page_has_content(room.randomize_meetingid)
28
+ page_has_content(room.private)
29
+ page_has_content(room.attendee_password)
30
+ page_has_content(room.moderator_password)
31
+ page_has_content(room.welcome_msg)
32
+ page_has_content(room.logout_url)
33
+ page_has_content(room.dial_number)
34
+ page_has_content(room.voice_bridge)
35
+ page_has_content(room.max_participants)
36
+ page_has_content(room.external)
37
+ page_has_content(room.param)
38
+ end
@@ -0,0 +1,23 @@
1
+ Given /a user named "(.+)"/i do |username|
2
+ @username = username
3
+ # TODO useless for now
4
+ end
5
+
6
+ And /^registers a new BigBlueButton server$/i do
7
+ attrs = Factory.attributes_for(:bigbluebutton_server_integration)
8
+ fill_in("bigbluebutton_server[name]", :with => attrs[:name])
9
+ fill_in("bigbluebutton_server[url]", :with => attrs[:url])
10
+ fill_in("bigbluebutton_server[salt]", :with => attrs[:salt])
11
+ fill_in("bigbluebutton_server[version]", :with => attrs[:version])
12
+ fill_in("bigbluebutton_server[param]", :with => attrs[:param])
13
+ click_button("Create")
14
+ end
15
+
16
+ Then /(?:|I ) should see the information about this server/ do
17
+ server = BigbluebuttonServer.last
18
+ page_has_content(server.name)
19
+ page_has_content(server.url)
20
+ page_has_content(server.salt)
21
+ page_has_content(server.version)
22
+ page_has_content(server.param)
23
+ end
@@ -0,0 +1,3 @@
1
+ When /(?:|I ) go(es)? to (.+) page$/i do |_, page_name|
2
+ visit path_to(page_name)
3
+ end