bigbluebutton_rails 2.1.0 → 2.2.0
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 +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +4 -11
- data/Rakefile +15 -15
- data/app/controllers/bigbluebutton/recordings_controller.rb +1 -1
- data/app/controllers/bigbluebutton/rooms_controller.rb +10 -12
- data/app/controllers/bigbluebutton/servers_controller.rb +4 -5
- data/app/models/bigbluebutton_meeting.rb +1 -2
- data/app/models/bigbluebutton_metadata.rb +2 -2
- data/app/models/bigbluebutton_recording.rb +20 -5
- data/app/models/bigbluebutton_room.rb +80 -102
- data/app/models/bigbluebutton_server.rb +31 -17
- data/app/views/bigbluebutton/recordings/_form.html.erb +13 -13
- data/app/views/bigbluebutton/rooms/_form.html.erb +0 -4
- data/app/views/bigbluebutton/rooms/_rooms.html.erb +0 -4
- data/app/views/bigbluebutton/rooms/show.html.erb +0 -4
- data/app/workers/bigbluebutton_update_recordings.rb +2 -2
- data/config/locales/en.yml +1 -2
- data/config/locales/pt-br.yml +1 -2
- data/lib/bigbluebutton_rails.rb +22 -108
- data/lib/bigbluebutton_rails/background_tasks.rb +7 -3
- data/lib/bigbluebutton_rails/configuration.rb +80 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +7 -6
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/generators/bigbluebutton_rails/install_generator.rb +10 -1
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +0 -3
- data/lib/generators/bigbluebutton_rails/templates/migration_2_2_0.rb +13 -0
- data/spec/controllers/bigbluebutton/recordings_controller_json_responses_spec.rb +4 -5
- data/spec/controllers/bigbluebutton/recordings_controller_spec.rb +3 -2
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +1 -1
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +4 -4
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +53 -38
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +7 -19
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +32 -51
- data/spec/factories/bigbluebutton_meeting.rb +0 -1
- data/spec/factories/bigbluebutton_recording.rb +1 -0
- data/spec/factories/bigbluebutton_room.rb +0 -1
- data/spec/models/bigbluebutton_meeting_db_spec.rb +0 -1
- data/spec/models/bigbluebutton_meeting_spec.rb +0 -3
- data/spec/models/bigbluebutton_metadata_spec.rb +4 -4
- data/spec/models/bigbluebutton_recording_spec.rb +32 -0
- data/spec/models/bigbluebutton_room_db_spec.rb +0 -2
- data/spec/models/bigbluebutton_room_spec.rb +138 -244
- data/spec/models/bigbluebutton_server_spec.rb +40 -21
- data/spec/rails_app/db/seeds.rb +1 -1
- data/spec/rails_app/features/config.yml.example +4 -4
- data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +0 -1
- data/spec/rails_app/features/support/templates.rb +0 -4
- data/spec/rails_app/lib/tasks/db/populate.rake +2 -2
- data/spec/routing/bigbluebutton/servers_only_routing_spec.rb +4 -1
- data/spec/routing/bigbluebutton/servers_routing_spec.rb +4 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/support/mocked_server.rb +1 -1
- data/spec/workers/bigbluebutton_meeting_updater_spec.rb +3 -3
- metadata +4 -2
| @@ -83,10 +83,10 @@ module ActionDispatch::Routing | |
| 83 83 |  | 
| 84 84 | 
             
                def bigbluebutton_routes_default(*params) #:nodoc:
         | 
| 85 85 | 
             
                  options = params.extract_options!
         | 
| 86 | 
            -
                  options_scope = options.has_key?(:scope) ? options[:scope] : BigbluebuttonRails.routing_scope
         | 
| 86 | 
            +
                  options_scope = options.has_key?(:scope) ? options[:scope] : BigbluebuttonRails.configuration.routing_scope
         | 
| 87 87 | 
             
                  options_as = options.has_key?(:as) ? options[:as] : options_scope
         | 
| 88 88 | 
             
                  options_only = options.has_key?(:only) ? options[:only] : ["servers", "rooms", "recordings", "playback_types"]
         | 
| 89 | 
            -
                  BigbluebuttonRails.set_controllers(options[:controllers])
         | 
| 89 | 
            +
                  BigbluebuttonRails.configuration.set_controllers(options[:controllers])
         | 
| 90 90 |  | 
| 91 91 | 
             
                  scope options_scope, :as => options_as do
         | 
| 92 92 | 
             
                    add_routes_for_servers if options_only.include?("servers")
         | 
| @@ -101,7 +101,7 @@ module ActionDispatch::Routing | |
| 101 101 | 
             
                end
         | 
| 102 102 |  | 
| 103 103 | 
             
                def add_routes_for_rooms #:nodoc:
         | 
| 104 | 
            -
                  resources :rooms, :controller => BigbluebuttonRails.controllers[:rooms] do
         | 
| 104 | 
            +
                  resources :rooms, :controller => BigbluebuttonRails.configuration.controllers[:rooms] do
         | 
| 105 105 | 
             
                    member do
         | 
| 106 106 | 
             
                      get :join
         | 
| 107 107 | 
             
                      get :running
         | 
| @@ -117,11 +117,12 @@ module ActionDispatch::Routing | |
| 117 117 | 
             
                end
         | 
| 118 118 |  | 
| 119 119 | 
             
                def add_routes_for_servers #:nodoc:
         | 
| 120 | 
            -
                  resources :servers, :controller => BigbluebuttonRails.controllers[:servers] do
         | 
| 120 | 
            +
                  resources :servers, :controller => BigbluebuttonRails.configuration.controllers[:servers] do
         | 
| 121 121 | 
             
                    member do
         | 
| 122 122 | 
             
                      get :activity
         | 
| 123 123 | 
             
                      get :rooms
         | 
| 124 124 | 
             
                      get :recordings
         | 
| 125 | 
            +
                      get :check
         | 
| 125 126 | 
             
                      post :publish_recordings
         | 
| 126 127 | 
             
                      post :unpublish_recordings
         | 
| 127 128 | 
             
                      post :fetch_recordings
         | 
| @@ -131,7 +132,7 @@ module ActionDispatch::Routing | |
| 131 132 |  | 
| 132 133 | 
             
                def add_routes_for_recordings #:nodoc:
         | 
| 133 134 | 
             
                  resources :recordings, :except => [:new, :create],
         | 
| 134 | 
            -
                                         :controller => BigbluebuttonRails.controllers[:recordings] do
         | 
| 135 | 
            +
                                         :controller => BigbluebuttonRails.configuration.controllers[:recordings] do
         | 
| 135 136 | 
             
                    member do
         | 
| 136 137 | 
             
                      get :play
         | 
| 137 138 | 
             
                      post :publish
         | 
| @@ -142,7 +143,7 @@ module ActionDispatch::Routing | |
| 142 143 |  | 
| 143 144 | 
             
                def add_routes_for_playback_types #:nodoc:
         | 
| 144 145 | 
             
                  resources :playback_types, :only => [:update],
         | 
| 145 | 
            -
                                             :controller => BigbluebuttonRails.controllers[:playback_types]
         | 
| 146 | 
            +
                                             :controller => BigbluebuttonRails.configuration.controllers[:playback_types]
         | 
| 146 147 | 
             
                end
         | 
| 147 148 | 
             
              end
         | 
| 148 149 | 
             
            end
         | 
| @@ -18,11 +18,20 @@ module BigbluebuttonRails | |
| 18 18 | 
             
                    ActiveRecord::Generators::Base.next_migration_number(dirname)
         | 
| 19 19 | 
             
                  end
         | 
| 20 20 |  | 
| 21 | 
            +
                  def source_root
         | 
| 22 | 
            +
                    BigbluebuttonRails::Generators::InstallGenerator.source_root
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
             | 
| 21 25 | 
             
                  def create_migration_file
         | 
| 22 26 | 
             
                    if migrate_to_version.blank?
         | 
| 23 27 | 
             
                      migration_template "#{migration_path}/migration.rb", "db/migrate/create_bigbluebutton_rails.rb"
         | 
| 24 28 | 
             
                    else
         | 
| 25 | 
            -
                       | 
| 29 | 
            +
                      migrations = Dir.glob(File.join(source_root, migration_path, "migration_#{version_filename}*"))
         | 
| 30 | 
            +
                      migrations.sort.each do |path|
         | 
| 31 | 
            +
                        filename = File.basename(path)
         | 
| 32 | 
            +
                        target_filename = filename.gsub('migration', 'bigbluebutton_rails_to')
         | 
| 33 | 
            +
                        migration_template "#{migration_path}/#{filename}", "db/migrate/#{target_filename}"
         | 
| 34 | 
            +
                      end
         | 
| 26 35 | 
             
                    end
         | 
| 27 36 | 
             
                  end
         | 
| 28 37 |  | 
| @@ -11,7 +11,6 @@ class CreateBigbluebuttonRails < ActiveRecord::Migration | |
| 11 11 | 
             
                end
         | 
| 12 12 |  | 
| 13 13 | 
             
                create_table :bigbluebutton_rooms do |t|
         | 
| 14 | 
            -
                  t.integer :server_id
         | 
| 15 14 | 
             
                  t.integer :owner_id
         | 
| 16 15 | 
             
                  t.string :owner_type
         | 
| 17 16 | 
             
                  t.string :meetingid
         | 
| @@ -36,7 +35,6 @@ class CreateBigbluebuttonRails < ActiveRecord::Migration | |
| 36 35 | 
             
                  t.boolean :allow_start_stop_recording, default: true
         | 
| 37 36 | 
             
                  t.timestamps
         | 
| 38 37 | 
             
                end
         | 
| 39 | 
            -
                add_index :bigbluebutton_rooms, :server_id
         | 
| 40 38 | 
             
                add_index :bigbluebutton_rooms, :meetingid, :unique => true
         | 
| 41 39 |  | 
| 42 40 | 
             
                create_table :bigbluebutton_room_options do |t|
         | 
| @@ -92,7 +90,6 @@ class CreateBigbluebuttonRails < ActiveRecord::Migration | |
| 92 90 | 
             
                end
         | 
| 93 91 |  | 
| 94 92 | 
             
                create_table :bigbluebutton_meetings do |t|
         | 
| 95 | 
            -
                  t.integer :server_id
         | 
| 96 93 | 
             
                  t.string :server_url
         | 
| 97 94 | 
             
                  t.string :server_secret
         | 
| 98 95 | 
             
                  t.integer :room_id
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            class BigbluebuttonRailsTo220 < ActiveRecord::Migration
         | 
| 2 | 
            +
              def self.up
         | 
| 3 | 
            +
                remove_column :bigbluebutton_meetings, :server_id
         | 
| 4 | 
            +
                remove_column :bigbluebutton_rooms, :server_id
         | 
| 5 | 
            +
                remove_index :bigbluebutton_rooms, :server_id
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              def self.down
         | 
| 9 | 
            +
                add_column :bigbluebutton_meetings, :server_id, :integer
         | 
| 10 | 
            +
                add_column :bigbluebutton_rooms, :server_id, :integer
         | 
| 11 | 
            +
                add_index :bigbluebutton_rooms, :server_id
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
            end
         | 
| @@ -45,16 +45,15 @@ describe Bigbluebutton::RecordingsController do | |
| 45 45 | 
             
                  end
         | 
| 46 46 |  | 
| 47 47 | 
             
                  context "on failure" do
         | 
| 48 | 
            +
                    before {
         | 
| 49 | 
            +
                      BigbluebuttonRecording.any_instance.should_receive(:update_attributes).and_return(false)
         | 
| 50 | 
            +
                    }
         | 
| 48 51 | 
             
                    before(:each) {
         | 
| 49 | 
            -
                      new_recording.recordid = nil # invalid
         | 
| 50 52 | 
             
                      put :update, :id => @recording.to_param, :bigbluebutton_recording => new_recording.attributes, :format => 'json'
         | 
| 51 53 | 
             
                    }
         | 
| 52 54 | 
             
                    it { should respond_with(:unprocessable_entity) }
         | 
| 53 55 | 
             
                    it { should respond_with_content_type('application/json') }
         | 
| 54 | 
            -
                    it {
         | 
| 55 | 
            -
                      new_recording.save # should fail
         | 
| 56 | 
            -
                      should respond_with_json(new_recording.errors.full_messages.to_json)
         | 
| 57 | 
            -
                    }
         | 
| 56 | 
            +
                    it { should respond_with_json([].to_json) }
         | 
| 58 57 | 
             
                  end
         | 
| 59 58 | 
             
                end
         | 
| 60 59 |  | 
| @@ -72,7 +72,8 @@ describe Bigbluebutton::RecordingsController do | |
| 72 72 | 
             
                  }
         | 
| 73 73 | 
             
                  it {
         | 
| 74 74 | 
             
                    saved = BigbluebuttonRecording.find(recording)
         | 
| 75 | 
            -
                     | 
| 75 | 
            +
                    ignored = new_recording.attributes.keys - ['description'] # only description is editable
         | 
| 76 | 
            +
                    saved.should have_same_attributes_as(new_recording, ignored)
         | 
| 76 77 | 
             
                  }
         | 
| 77 78 | 
             
                  it { should set_the_flash.to(I18n.t('bigbluebutton_rails.recordings.notice.update.success')) }
         | 
| 78 79 | 
             
                end
         | 
| @@ -91,7 +92,7 @@ describe Bigbluebutton::RecordingsController do | |
| 91 92 | 
             
                  let(:attrs) { FactoryGirl.attributes_for(:bigbluebutton_recording) }
         | 
| 92 93 | 
             
                  let(:params) { { :bigbluebutton_recording => attrs } }
         | 
| 93 94 | 
             
                  let(:allowed_params) {
         | 
| 94 | 
            -
                    [ : | 
| 95 | 
            +
                    [ :description ]
         | 
| 95 96 | 
             
                  }
         | 
| 96 97 | 
             
                  it {
         | 
| 97 98 | 
             
                    # we just check that the rails method 'permit' is being called on the hash with the
         | 
| @@ -8,7 +8,7 @@ describe Bigbluebutton::RoomsController do | |
| 8 8 | 
             
                let(:bbb_error_msg) { SecureRandom.hex(250) }
         | 
| 9 9 | 
             
                let(:bbb_error) { BigBlueButton::BigBlueButtonException.new(bbb_error_msg) }
         | 
| 10 10 | 
             
                let(:http_referer) { bigbluebutton_server_path(mocked_server) }
         | 
| 11 | 
            -
                let(:room) { FactoryGirl.create(:bigbluebutton_room | 
| 11 | 
            +
                let(:room) { FactoryGirl.create(:bigbluebutton_room) }
         | 
| 12 12 | 
             
                before {
         | 
| 13 13 | 
             
                  BigbluebuttonRoom.stub(:find_by_param) { room }
         | 
| 14 14 | 
             
                  BigbluebuttonRoom.stub(:find) { room }
         | 
| @@ -3,7 +3,7 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe Bigbluebutton::RoomsController do
         | 
| 4 4 | 
             
              render_views
         | 
| 5 5 | 
             
              let(:server) { FactoryGirl.create(:bigbluebutton_server) }
         | 
| 6 | 
            -
              let(:room) { FactoryGirl.create(:bigbluebutton_room | 
| 6 | 
            +
              let(:room) { FactoryGirl.create(:bigbluebutton_room) }
         | 
| 7 7 | 
             
              before do
         | 
| 8 8 | 
             
                BigbluebuttonRoom.stub(:find_by_param) { room }
         | 
| 9 9 | 
             
                BigbluebuttonRoom.stub(:find) { room }
         | 
| @@ -13,8 +13,8 @@ describe Bigbluebutton::RoomsController do | |
| 13 13 |  | 
| 14 14 | 
             
                describe "#index" do
         | 
| 15 15 | 
             
                  before do
         | 
| 16 | 
            -
                    @room1 = FactoryGirl.create(:bigbluebutton_room | 
| 17 | 
            -
                    @room2 = FactoryGirl.create(:bigbluebutton_room | 
| 16 | 
            +
                    @room1 = FactoryGirl.create(:bigbluebutton_room)
         | 
| 17 | 
            +
                    @room2 = FactoryGirl.create(:bigbluebutton_room)
         | 
| 18 18 | 
             
                  end
         | 
| 19 19 | 
             
                  before(:each) { get :index, :format => 'json' }
         | 
| 20 20 | 
             
                  it { should respond_with(:success) }
         | 
| @@ -41,7 +41,7 @@ describe Bigbluebutton::RoomsController do | |
| 41 41 | 
             
                end
         | 
| 42 42 |  | 
| 43 43 | 
             
                describe "#create" do
         | 
| 44 | 
            -
                  let(:new_room) { FactoryGirl.build(:bigbluebutton_room | 
| 44 | 
            +
                  let(:new_room) { FactoryGirl.build(:bigbluebutton_room) }
         | 
| 45 45 |  | 
| 46 46 | 
             
                  context "on success" do
         | 
| 47 47 | 
             
                    before(:each) {
         | 
| @@ -6,8 +6,8 @@ require 'bigbluebutton_api' | |
| 6 6 |  | 
| 7 7 | 
             
            describe Bigbluebutton::RoomsController do
         | 
| 8 8 | 
             
              render_views
         | 
| 9 | 
            -
              let(:server) { FactoryGirl.create(:bigbluebutton_server) }
         | 
| 10 | 
            -
              let(:room) { FactoryGirl.create(:bigbluebutton_room | 
| 9 | 
            +
              let!(:server) { FactoryGirl.create(:bigbluebutton_server) }
         | 
| 10 | 
            +
              let!(:room) { FactoryGirl.create(:bigbluebutton_room) }
         | 
| 11 11 | 
             
              let(:params_to_ignore) { ['moderator_api_password', 'attendee_api_password', 'create_time'] }
         | 
| 12 12 |  | 
| 13 13 | 
             
              describe "#index" do
         | 
| @@ -86,7 +86,6 @@ describe Bigbluebutton::RoomsController do | |
| 86 86 | 
             
                  request.env["HTTP_REFERER"] = http_referer
         | 
| 87 87 | 
             
                  controller.should_receive(:set_request_headers)
         | 
| 88 88 | 
             
                  mock_server_and_api
         | 
| 89 | 
            -
                  room.server = mocked_server
         | 
| 90 89 | 
             
                  controller.stub(:bigbluebutton_user) { user }
         | 
| 91 90 | 
             
                }
         | 
| 92 91 |  | 
| @@ -137,7 +136,7 @@ describe Bigbluebutton::RoomsController do | |
| 137 136 | 
             
              end
         | 
| 138 137 |  | 
| 139 138 | 
             
              describe "#create" do
         | 
| 140 | 
            -
                let(:new_room) { FactoryGirl.build(:bigbluebutton_room | 
| 139 | 
            +
                let(:new_room) { FactoryGirl.build(:bigbluebutton_room) }
         | 
| 141 140 |  | 
| 142 141 | 
             
                context "on success" do
         | 
| 143 142 | 
             
                  before :each do
         | 
| @@ -206,7 +205,7 @@ describe Bigbluebutton::RoomsController do | |
| 206 205 | 
             
                  let(:attrs) { FactoryGirl.attributes_for(:bigbluebutton_room) }
         | 
| 207 206 | 
             
                  let(:params) { { :bigbluebutton_room => attrs } }
         | 
| 208 207 | 
             
                  let(:allowed_params) {
         | 
| 209 | 
            -
                    [ :name, : | 
| 208 | 
            +
                    [ :name, :meetingid, :attendee_key, :moderator_key, :welcome_msg,
         | 
| 210 209 | 
             
                      :private, :logout_url, :dial_number, :voice_bridge, :max_participants, :owner_id,
         | 
| 211 210 | 
             
                      :owner_type, :external, :param, :record_meeting, :duration, :default_layout, :presenter_share_only,
         | 
| 212 211 | 
             
                      :auto_start_video, :auto_start_audio, :background,
         | 
| @@ -247,21 +246,20 @@ describe Bigbluebutton::RoomsController do | |
| 247 246 |  | 
| 248 247 | 
             
              describe "#update" do
         | 
| 249 248 | 
             
                let(:new_room) { FactoryGirl.build(:bigbluebutton_room) }
         | 
| 250 | 
            -
                before { @room = room } # need this to trigger let(:room) and actually create the room
         | 
| 251 249 |  | 
| 252 250 | 
             
                context "on success" do
         | 
| 253 251 | 
             
                  before :each do
         | 
| 254 252 | 
             
                    expect {
         | 
| 255 | 
            -
                      put :update, :id =>  | 
| 253 | 
            +
                      put :update, :id => room.to_param, :bigbluebutton_room => new_room.attributes
         | 
| 256 254 | 
             
                    }.not_to change{ BigbluebuttonRoom.count }
         | 
| 257 255 | 
             
                  end
         | 
| 258 256 | 
             
                  it {
         | 
| 259 | 
            -
                    saved = BigbluebuttonRoom.find( | 
| 257 | 
            +
                    saved = BigbluebuttonRoom.find(room)
         | 
| 260 258 | 
             
                    should respond_with(:redirect)
         | 
| 261 259 | 
             
                    should redirect_to bigbluebutton_room_path(saved)
         | 
| 262 260 | 
             
                  }
         | 
| 263 261 | 
             
                  it {
         | 
| 264 | 
            -
                    saved = BigbluebuttonRoom.find( | 
| 262 | 
            +
                    saved = BigbluebuttonRoom.find(room)
         | 
| 265 263 | 
             
                    saved.should have_same_attributes_as(new_room, params_to_ignore)
         | 
| 266 264 | 
             
                  }
         | 
| 267 265 | 
             
                  it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.notice.update.success')) }
         | 
| @@ -270,16 +268,16 @@ describe Bigbluebutton::RoomsController do | |
| 270 268 | 
             
                context "on failure" do
         | 
| 271 269 | 
             
                  before :each do
         | 
| 272 270 | 
             
                    new_room.name = nil # invalid
         | 
| 273 | 
            -
                    put :update, :id =>  | 
| 271 | 
            +
                    put :update, :id => room.to_param, :bigbluebutton_room => new_room.attributes
         | 
| 274 272 | 
             
                  end
         | 
| 275 273 | 
             
                  it { should render_template(:edit) }
         | 
| 276 | 
            -
                  it { should assign_to(:room).with( | 
| 274 | 
            +
                  it { should assign_to(:room).with(room) }
         | 
| 277 275 | 
             
                end
         | 
| 278 276 |  | 
| 279 277 | 
             
                context "with :redir_url" do
         | 
| 280 278 | 
             
                  context "on success" do
         | 
| 281 279 | 
             
                    before(:each) {
         | 
| 282 | 
            -
                      put :update, :id =>  | 
| 280 | 
            +
                      put :update, :id => room.to_param, :bigbluebutton_room => new_room.attributes, :redir_url => "/any"
         | 
| 283 281 | 
             
                    }
         | 
| 284 282 | 
             
                    it { should respond_with(:redirect) }
         | 
| 285 283 | 
             
                    it { should redirect_to "/any" }
         | 
| @@ -288,7 +286,7 @@ describe Bigbluebutton::RoomsController do | |
| 288 286 | 
             
                  context "on failure" do
         | 
| 289 287 | 
             
                    before(:each) {
         | 
| 290 288 | 
             
                      new_room.name = nil # invalid
         | 
| 291 | 
            -
                      put :update, :id =>  | 
| 289 | 
            +
                      put :update, :id => room.to_param, :bigbluebutton_room => new_room.attributes, :redir_url => "/any"
         | 
| 292 290 | 
             
                    }
         | 
| 293 291 | 
             
                    it { should respond_with(:redirect) }
         | 
| 294 292 | 
             
                    it { should redirect_to "/any" }
         | 
| @@ -299,7 +297,7 @@ describe Bigbluebutton::RoomsController do | |
| 299 297 | 
             
                  let(:attrs) { FactoryGirl.attributes_for(:bigbluebutton_room) }
         | 
| 300 298 | 
             
                  let(:params) { { :bigbluebutton_room => attrs } }
         | 
| 301 299 | 
             
                  let(:allowed_params) {
         | 
| 302 | 
            -
                    [ :name, : | 
| 300 | 
            +
                    [ :name, :meetingid, :attendee_key, :moderator_key, :welcome_msg,
         | 
| 303 301 | 
             
                      :private, :logout_url, :dial_number, :voice_bridge, :max_participants, :owner_id,
         | 
| 304 302 | 
             
                      :owner_type, :external, :param, :record_meeting, :duration, :default_layout, :presenter_share_only,
         | 
| 305 303 | 
             
                      :auto_start_video, :auto_start_audio, :background,
         | 
| @@ -309,12 +307,12 @@ describe Bigbluebutton::RoomsController do | |
| 309 307 | 
             
                  it {
         | 
| 310 308 | 
             
                    # we just check that the rails method 'permit' is being called on the hash with the
         | 
| 311 309 | 
             
                    # correct parameters
         | 
| 312 | 
            -
                    BigbluebuttonRoom.stub(:find_by_param).and_return( | 
| 313 | 
            -
                     | 
| 310 | 
            +
                    BigbluebuttonRoom.stub(:find_by_param).and_return(room)
         | 
| 311 | 
            +
                    room.stub(:update_attributes).and_return(true)
         | 
| 314 312 | 
             
                    attrs.stub(:permit).and_return(attrs)
         | 
| 315 313 | 
             
                    controller.stub(:params).and_return(params)
         | 
| 316 314 |  | 
| 317 | 
            -
                    put :update, :id =>  | 
| 315 | 
            +
                    put :update, :id => room.to_param, :bigbluebutton_room => attrs
         | 
| 318 316 | 
             
                    attrs.should have_received(:permit).with(*allowed_params)
         | 
| 319 317 | 
             
                  }
         | 
| 320 318 | 
             
                end
         | 
| @@ -323,15 +321,15 @@ describe Bigbluebutton::RoomsController do | |
| 323 321 | 
             
                describe "if parameters are not informed" do
         | 
| 324 322 | 
             
                  before(:each) {}
         | 
| 325 323 | 
             
                  it {
         | 
| 326 | 
            -
                    put :update, :id =>  | 
| 327 | 
            -
                    should redirect_to(bigbluebutton_room_path( | 
| 324 | 
            +
                    put :update, :id => room.to_param
         | 
| 325 | 
            +
                    should redirect_to(bigbluebutton_room_path(room))
         | 
| 328 326 | 
             
                  }
         | 
| 329 327 | 
             
                end
         | 
| 330 328 |  | 
| 331 329 | 
             
                context "doesn't override @room" do
         | 
| 332 330 | 
             
                  let!(:other_room) { FactoryGirl.create(:bigbluebutton_room) }
         | 
| 333 331 | 
             
                  before { controller.instance_variable_set(:@room, other_room) }
         | 
| 334 | 
            -
                  before(:each) { put :update, :id =>  | 
| 332 | 
            +
                  before(:each) { put :update, :id => room.to_param, :bigbluebutton_room => new_room.attributes }
         | 
| 335 333 | 
             
                  it { should assign_to(:room).with(other_room) }
         | 
| 336 334 | 
             
                end
         | 
| 337 335 | 
             
              end
         | 
| @@ -817,7 +815,7 @@ describe Bigbluebutton::RoomsController do | |
| 817 815 |  | 
| 818 816 | 
             
                context "if the room has no server associated" do
         | 
| 819 817 | 
             
                  before(:each) {
         | 
| 820 | 
            -
                    room.stub(: | 
| 818 | 
            +
                    room.stub(:select_server) { nil }
         | 
| 821 819 | 
             
                    post :fetch_recordings, :id => room.to_param
         | 
| 822 820 | 
             
                  }
         | 
| 823 821 | 
             
                  it { should respond_with(:redirect) }
         | 
| @@ -834,9 +832,10 @@ describe Bigbluebutton::RoomsController do | |
| 834 832 | 
             
                    it {should respond_with(:redirect) }
         | 
| 835 833 | 
             
                    it { should redirect_to "/any" }
         | 
| 836 834 | 
             
                  end
         | 
| 835 | 
            +
             | 
| 837 836 | 
             
                  context "on failure" do
         | 
| 838 837 | 
             
                    before(:each) {
         | 
| 839 | 
            -
                      room.stub(: | 
| 838 | 
            +
                      room.stub(:select_server) { nil }
         | 
| 840 839 | 
             
                      post :fetch_recordings, :id => room.to_param, :redir_url => "/any"
         | 
| 841 840 | 
             
                    }
         | 
| 842 841 | 
             
                    it {should respond_with(:redirect) }
         | 
| @@ -848,7 +847,6 @@ describe Bigbluebutton::RoomsController do | |
| 848 847 | 
             
                  let!(:other_room) { FactoryGirl.create(:bigbluebutton_room) }
         | 
| 849 848 | 
             
                  before {
         | 
| 850 849 | 
             
                    controller.instance_variable_set(:@room, other_room)
         | 
| 851 | 
            -
                    other_room.server = nil
         | 
| 852 850 | 
             
                  }
         | 
| 853 851 | 
             
                  before(:each) { post :fetch_recordings, :id => room.to_param }
         | 
| 854 852 | 
             
                  it { should assign_to(:room).with(other_room) }
         | 
| @@ -862,7 +860,7 @@ describe Bigbluebutton::RoomsController do | |
| 862 860 | 
             
                  FactoryGirl.create(:bigbluebutton_recording)
         | 
| 863 861 |  | 
| 864 862 | 
             
                  # one that belongs to another room in the same server
         | 
| 865 | 
            -
                  room2 = FactoryGirl.create(:bigbluebutton_room | 
| 863 | 
            +
                  room2 = FactoryGirl.create(:bigbluebutton_room)
         | 
| 866 864 | 
             
                  FactoryGirl.create(:bigbluebutton_recording, :room => room2)
         | 
| 867 865 | 
             
                end
         | 
| 868 866 | 
             
                before(:each) { get :recordings, :id => room.to_param }
         | 
| @@ -976,20 +974,23 @@ describe Bigbluebutton::RoomsController do | |
| 976 974 | 
             
                }
         | 
| 977 975 |  | 
| 978 976 | 
             
                context "when the user has permission to create the meeting" do
         | 
| 979 | 
            -
             | 
| 980 | 
            -
             | 
| 981 | 
            -
                     | 
| 982 | 
            -
                      .and_return( | 
| 983 | 
            -
             | 
| 984 | 
            -
             | 
| 985 | 
            -
             | 
| 986 | 
            -
             | 
| 987 | 
            -
             | 
| 988 | 
            -
             | 
| 989 | 
            -
             | 
| 990 | 
            -
             | 
| 991 | 
            -
             | 
| 992 | 
            -
             | 
| 977 | 
            +
             | 
| 978 | 
            +
                  context "in the standard case" do
         | 
| 979 | 
            +
                    before {
         | 
| 980 | 
            +
                      room.should_receive(:fetch_is_running?).at_least(:once).and_return(false)
         | 
| 981 | 
            +
                      controller.stub(:bigbluebutton_can_create?).with(room, :attendee)
         | 
| 982 | 
            +
                        .and_return(true)
         | 
| 983 | 
            +
                      controller.stub(:bigbluebutton_create_options).with(room)
         | 
| 984 | 
            +
                        .and_return({ custom: true })
         | 
| 985 | 
            +
                      room.should_receive(:create_meeting)
         | 
| 986 | 
            +
                        .with(user, controller.request, { custom: true }).and_return(true)
         | 
| 987 | 
            +
                      room.should_receive(:fetch_new_token).and_return(nil)
         | 
| 988 | 
            +
                      room.should_receive(:join_url).and_return("http://test.com/join/url/")
         | 
| 989 | 
            +
                    }
         | 
| 990 | 
            +
                    before(:each) { get :join, :id => room.to_param }
         | 
| 991 | 
            +
                    it { should respond_with(:redirect) }
         | 
| 992 | 
            +
                    it { should redirect_to("http://test.com/join/url/") }
         | 
| 993 | 
            +
                  end
         | 
| 993 994 | 
             
                end
         | 
| 994 995 |  | 
| 995 996 | 
             
                context "when the user doesn't have permission to create the meeting" do
         | 
| @@ -1190,6 +1191,20 @@ describe Bigbluebutton::RoomsController do | |
| 1190 1191 | 
             
                  it { should set_the_flash.to(bbb_error_msg[0..200]) }
         | 
| 1191 1192 | 
             
                end
         | 
| 1192 1193 |  | 
| 1194 | 
            +
                context "doesn't break if a guest user has permission to create a meeting" do
         | 
| 1195 | 
            +
                  before {
         | 
| 1196 | 
            +
                    room.stub(:fetch_is_running?).and_return(false)
         | 
| 1197 | 
            +
                    controller.stub(:bigbluebutton_create_options).and_return({ custom: true })
         | 
| 1198 | 
            +
                    controller.stub(:bigbluebutton_can_create?).and_return(true)
         | 
| 1199 | 
            +
                    room.stub(:create_meeting).and_return(true)
         | 
| 1200 | 
            +
                    controller.stub(:bigbluebutton_user).and_return(nil)
         | 
| 1201 | 
            +
                    room.stub(:join_url).and_return("http://test.com/join/url/")
         | 
| 1202 | 
            +
                  }
         | 
| 1203 | 
            +
                  before(:each) { get :join, :id => room.to_param, :user => { :name => "Elftor" } }
         | 
| 1204 | 
            +
                  it { should respond_with(:redirect) }
         | 
| 1205 | 
            +
                  it { should redirect_to("http://test.com/join/url/") }
         | 
| 1206 | 
            +
                end
         | 
| 1207 | 
            +
             | 
| 1193 1208 | 
             
              end
         | 
| 1194 1209 |  | 
| 1195 1210 | 
             
            end
         | 
| @@ -2,12 +2,13 @@ require 'spec_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            describe Bigbluebutton::ServersController do
         | 
| 4 4 | 
             
              render_views
         | 
| 5 | 
            -
              let(:server) { FactoryGirl.create(:bigbluebutton_server) }
         | 
| 5 | 
            +
              let!(:server) { FactoryGirl.create(:bigbluebutton_server) }
         | 
| 6 6 |  | 
| 7 7 | 
             
              context "json responses for" do
         | 
| 8 8 |  | 
| 9 9 | 
             
                describe "#index" do
         | 
| 10 10 | 
             
                  before do
         | 
| 11 | 
            +
                    BigbluebuttonServer.destroy_all
         | 
| 11 12 | 
             
                    @server1 = FactoryGirl.create(:bigbluebutton_server)
         | 
| 12 13 | 
             
                    @server2 = FactoryGirl.create(:bigbluebutton_server)
         | 
| 13 14 | 
             
                  end
         | 
| @@ -66,12 +67,11 @@ describe Bigbluebutton::ServersController do | |
| 66 67 |  | 
| 67 68 | 
             
                describe "#update" do
         | 
| 68 69 | 
             
                  let(:new_server) { FactoryGirl.build(:bigbluebutton_server) }
         | 
| 69 | 
            -
                  before { @server = server }
         | 
| 70 70 |  | 
| 71 71 | 
             
                  context "on success" do
         | 
| 72 72 | 
             
                    before(:each) {
         | 
| 73 73 | 
             
                      BigbluebuttonServer.any_instance.stub(:set_api_version_from_server)
         | 
| 74 | 
            -
                      put :update, :id =>  | 
| 74 | 
            +
                      put :update, :id => server.to_param, :bigbluebutton_server => new_server.attributes, :format => 'json'
         | 
| 75 75 | 
             
                    }
         | 
| 76 76 | 
             
                    it { should respond_with(:success) }
         | 
| 77 77 | 
             
                    it { should respond_with_content_type('application/json') }
         | 
| @@ -81,7 +81,7 @@ describe Bigbluebutton::ServersController do | |
| 81 81 | 
             
                  context "on failure" do
         | 
| 82 82 | 
             
                    before(:each) {
         | 
| 83 83 | 
             
                      new_server.url = nil # invalid
         | 
| 84 | 
            -
                      put :update, :id =>  | 
| 84 | 
            +
                      put :update, :id => server.to_param, :bigbluebutton_server => new_server.attributes, :format => 'json'
         | 
| 85 85 | 
             
                    }
         | 
| 86 86 | 
             
                    it { should respond_with(:unprocessable_entity) }
         | 
| 87 87 | 
             
                    it { should respond_with_content_type('application/json') }
         | 
| @@ -94,8 +94,7 @@ describe Bigbluebutton::ServersController do | |
| 94 94 |  | 
| 95 95 | 
             
                describe "#destroy" do
         | 
| 96 96 | 
             
                  before :each do
         | 
| 97 | 
            -
                     | 
| 98 | 
            -
                    delete :destroy, :id => @server.to_param, :format => 'json'
         | 
| 97 | 
            +
                    delete :destroy, :id => server.to_param, :format => 'json'
         | 
| 99 98 | 
             
                  end
         | 
| 100 99 | 
             
                  it { should respond_with(:success) }
         | 
| 101 100 | 
             
                  it { should respond_with_content_type('application/json') }
         | 
| @@ -103,8 +102,8 @@ describe Bigbluebutton::ServersController do | |
| 103 102 | 
             
                end
         | 
| 104 103 |  | 
| 105 104 | 
             
                describe "#activity" do
         | 
| 106 | 
            -
                  let(:room1) { FactoryGirl.create(:bigbluebutton_room | 
| 107 | 
            -
                  let(:room2) { FactoryGirl.create(:bigbluebutton_room | 
| 105 | 
            +
                  let(:room1) { FactoryGirl.create(:bigbluebutton_room) }
         | 
| 106 | 
            +
                  let(:room2) { FactoryGirl.create(:bigbluebutton_room) }
         | 
| 108 107 | 
             
                  before do
         | 
| 109 108 | 
             
                    # so we return our mocked server
         | 
| 110 109 | 
             
                    BigbluebuttonServer.stub(:find_by_param).with(server.to_param).
         | 
| @@ -154,17 +153,6 @@ describe Bigbluebutton::ServersController do | |
| 154 153 |  | 
| 155 154 | 
             
                end
         | 
| 156 155 |  | 
| 157 | 
            -
                describe "#rooms" do
         | 
| 158 | 
            -
                  before do
         | 
| 159 | 
            -
                    @room1 = FactoryGirl.create(:bigbluebutton_room, :server => server)
         | 
| 160 | 
            -
                    @room2 = FactoryGirl.create(:bigbluebutton_room, :server => server)
         | 
| 161 | 
            -
                  end
         | 
| 162 | 
            -
                  before(:each) { get :rooms, :id => server.to_param, :format => 'json' }
         | 
| 163 | 
            -
                  it { should respond_with(:success) }
         | 
| 164 | 
            -
                  it { should respond_with_content_type('application/json') }
         | 
| 165 | 
            -
                  it { should respond_with_json([@room1, @room2].to_json) }
         | 
| 166 | 
            -
                end
         | 
| 167 | 
            -
             | 
| 168 156 | 
             
                describe "#fetch_recordings" do
         | 
| 169 157 | 
             
                  it "on success"
         | 
| 170 158 | 
             
                  it "on error"
         |