Sha256: 0c9923766d897be082f9cdbe0bcf051709ff4ba6596f0709e442f5557cf55f3b

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Glman::Commands::Configs::UsersConfig do
  subject{ described_class.new(config_manager: config_manager) }
  let(:config_manager) { double('config_manager') }

  describe '#set' do
    before(:each) {config_manager.should_receive(:set).with({ users: set_users })}
    let(:set_users) {{'damian@o2.pl' => {id: 1} , 'pawel@o2.pl' => {id: 2}}}

    it 'should set new users' do
      subject.set(set_users)
    end
  end

  describe '#get' do
    before(:each) {config_manager.should_receive(:get).and_return(get_users)}
    let(:current_users) {{'pawel@o2.pl' => {id: 2}}}
    let(:get_users)      {{users: current_users}}

    it 'should receive current users' do
      subject.get.should eq current_users
    end

    context 'when configuration is empty' do
      let(:current_users) {Glman::Commands::Configs::UsersConfig::DEFAULT}

      it 'should receive default users' do
        subject.get.should eq current_users
      end
    end
  end

  describe '#clear' do
    before(:each) {config_manager.should_receive(:set).with({ users: set_users })}
    let(:set_users) { Glman::Commands::Configs::UsersConfig::DEFAULT }

    it 'should set users to default' do
      subject.clear
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glman-0.1.3 spec/glman/commands/config/users_config_spec.rb
glman-0.1.2 spec/glman/commands/config/users_config_spec.rb