Sha256: eb534ce88a92e0609b18f0fdc347a39ab684c7d427f4258d60de08d304eb2448

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

# coding: utf-8
require 'spec_helper'

describe BigbluebuttonAttendee do
  it "loaded correctly" do
    BigbluebuttonAttendee.new.should be_a_kind_of(ActiveRecord::Base)
  end

  before { FactoryGirl.create(:bigbluebutton_attendee) }

  context "gets params from hash" do
    let(:hash) { {:userID=>"user_id", :fullName=>"House M.D.", :role=>"MODERATOR"} }
    let(:attendee) { BigbluebuttonAttendee.new }

    it "standard case" do
      attendee.from_hash(hash)
      attendee.user_id.should == "user_id"
      attendee.user_name.should == "House M.D."
      attendee.role.should == :moderator
    end

    it "converts user_id to string" do
      hash[:userID] = 123
      attendee.from_hash(hash)
      attendee.user_id.should == "123"
    end

    it "role is not case sensitive" do
      hash[:role] = "mODErAtOR"
      attendee.from_hash(hash)
      attendee.role.should == :moderator
    end

    it "any role other than 'moderator' is attendee" do
      hash[:role] = "VIEWER"
      attendee.from_hash(hash)
      attendee.role.should == :attendee

      hash[:role] = "whatever"
      attendee.from_hash(hash)
      attendee.role.should == :attendee
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bigbluebutton_rails-3.0.0 spec/models/bigbluebutton_attendee_spec.rb
bigbluebutton_rails-2.3.0 spec/models/bigbluebutton_attendee_spec.rb