Sha256: ca75a75d836489203b7f521e2e5ce42990688b37bd1ae01f34fa98fba9ea89d8

Contents?: true

Size: 984 Bytes

Versions: 13

Compression:

Stored size: 984 Bytes

Contents

require 'spec_helper'

describe User do
  let(:user) { User.find_by(uid: 'foo@bar.com') }
  let(:user_json) { {
    uid: 'foo@bar.com',
    first_name: 'Foo',
    last_name: 'Bar',
    permissions: {student: 'test/example'},
    id: 1
  } }

  context 'when new user' do
    before { User.import_from_json! user_json }
    it { expect(user.uid).to eq 'foo@bar.com' }
    it { expect(user.name).to eq 'Foo Bar' }
    it { expect(user.student_here?).to be true }
  end

  context 'when user exists' do
    let(:new_json) { {
      uid: 'foo@bar.com',
      first_name: 'Foo',
      last_name: 'Baz',
      permissions: {student: 'test/example2'},
      id: 1
    } }
    before { User.import_from_json! user_json }
    before { User.import_from_json! new_json }
    it { expect(user.name).to eq 'Foo Baz' }
    it { expect(user.student_here?).to be true }
    it { expect(user.student? 'test/example2').to be true }
    it { expect(user.student? 'test/example').to be false }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-5.0.12 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.11 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.10 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.9 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.8 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.7 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.6 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.5 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.4 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.3 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.2 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.1 spec/models/user_changed_spec.rb
mumuki-laboratory-5.0.0 spec/models/user_changed_spec.rb