Sha256: 3207c54baaf55b6478cd0f80ef660c54a8734cdadd6870ae8a07f80b04f0440b

Contents?: true

Size: 716 Bytes

Versions: 6

Compression:

Stored size: 716 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 '#_validate_inputs' do
    let(:required) { ['param_a', 'param_c'] }
    let(:provided) { { 'param_a' => true, 'param_c' => true } }

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

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

end # Github::Validations::Required

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
github_api-0.5.4 spec/github/validations/required_spec.rb
github_api-0.5.3 spec/github/validations/required_spec.rb
github_api-0.5.2 spec/github/validations/required_spec.rb
github_api-0.5.1 spec/github/validations/required_spec.rb
github_api-0.5.0 spec/github/validations/required_spec.rb
github_api-0.5.0.rc1 spec/github/validations/required_spec.rb