Sha256: ff05329a5480e68d7f1e5e662606c9ba940903464f5cfdd8774a85b9f5dbadc9

Contents?: true

Size: 1.67 KB

Versions: 30

Compression:

Stored size: 1.67 KB

Contents

package_require('ree_errors/auth_error')

RSpec.describe ReeErrors::AuthError do
  link :add_load_path, from: :ree_i18n
  link :auth_error, from: :ree_errors

  before :all do
    add_load_path(Dir[File.join(__dir__, 'locales/*.yml')])
  end

  it {
    klass = auth_error(:code, 'ree_errors_test.error', msg: "test")
    error = klass.new

    expect(klass).to be_a(Class)
    expect(error).to be_a(ReeErrors::Error)
    expect(error.message).to eq('test')
    expect(error.code).to eq(:code)
    expect(error.type).to eq(:auth)
    expect(error.locale).to eq('ree_errors_test.error')
    expect(error.caller).to eq(self)
  }

  it {
    klass = auth_error(:code)

    expect {
      klass.new
    }.to raise_error(ArgumentError)
  }

  it {
    klass = auth_error(:code)
    error = klass.new('CUSTOM MESSAGE')

    expect(klass).to be_a(Class)
    expect(error).to be_a(ReeErrors::Error)
    expect(error.message).to eq('CUSTOM MESSAGE')
    expect(error.code).to eq(:code)
    expect(error.type).to eq(:auth)
    expect(error.locale).to eq(nil)
  }

  it {
    klass = auth_error(:code, 'locale_error')
    error = klass.new

    expect(klass).to be_a(Class)
    expect(error).to be_a(ReeErrors::Error)
    expect(error.message).to eq('locale error')
    expect(error.code).to eq(:code)
    expect(error.type).to eq(:auth)
    expect(error.locale).to eq("locale_error")
  }

  it {
    klass = auth_error(:code, 'locale_error1')
    error = klass.new

    expect(klass).to be_a(Class)
    expect(error).to be_a(ReeErrors::Error)
    expect(error.message).to eq('locale error 1')
    expect(error.code).to eq(:code)
    expect(error.type).to eq(:auth)
    expect(error.locale).to eq("locale_error1")
  }
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
ree_lib-1.0.124 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.123 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.122 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.121 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.120 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.119 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.118 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.117 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.116 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.115 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.114 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.113 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.112 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.111 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.110 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.109 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.108 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.107 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.106 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb
ree_lib-1.0.105 lib/ree_lib/packages/ree_errors/spec/ree_errors/auth_error_spec.rb