Sha256: 41814805cd86650405244926de552c274c7c2ee747e915ace0a7ee4179eef847

Contents?: true

Size: 728 Bytes

Versions: 40

Compression:

Stored size: 728 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require 'github_api/core_ext/hash'

describe Github::Validations::Required do

  let(:validator) {
    klaz = Class.new.extend(described_class)
  }

  context '#assert_required_keys' do
    let(:required) { ['param_a', 'param_c'] }
    let(:provided) { { 'param_a' => true, 'param_c' => true } }

    it 'detect missing parameter' do
      expect {
        validator.assert_required_keys(required, provided.except('param_c')).
          should be_false
      }.to raise_error(Github::Error::RequiredParams)
    end

    it 'asserts correct required parameters' do
      validator.assert_required_keys(required, provided).should be_true
    end
  end

end # Github::Validations::Required

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/validations/required_spec.rb
github_api-0.12.2 spec/github/validations/required_spec.rb
github_api-0.12.1 spec/github/validations/required_spec.rb
github_api-0.12.0 spec/github/validations/required_spec.rb
github_api-0.11.3 spec/github/validations/required_spec.rb
github_api-0.11.2 spec/github/validations/required_spec.rb
github_api-0.11.1 spec/github/validations/required_spec.rb
github_api-0.11.0 spec/github/validations/required_spec.rb
github_api-0.10.2 spec/github/validations/required_spec.rb
github_api-0.10.1 spec/github/validations/required_spec.rb
github_api-0.10.0 spec/github/validations/required_spec.rb
github_api-0.9.7 spec/github/validations/required_spec.rb
github_api-0.9.6 spec/github/validations/required_spec.rb
github_api-0.9.5 spec/github/validations/required_spec.rb
github_api-0.9.4 spec/github/validations/required_spec.rb
github_api-0.9.3 spec/github/validations/required_spec.rb
github_api-0.9.2 spec/github/validations/required_spec.rb
github_api-0.9.1 spec/github/validations/required_spec.rb
github_api-0.9.0 spec/github/validations/required_spec.rb
github_api-0.8.11 spec/github/validations/required_spec.rb