Sha256: 9393de411d43b83063e5c5426ffb48f7a3ec3f0ba5023ee3b4fc26f88a4dcfb0

Contents?: true

Size: 1.1 KB

Versions: 36

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Validations::Format do

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

  context '#_validate_params_values' do
    let(:permitted) {
      {
        'param_a' => ['a', 'b'],
        'param_b' => /^github$/
      }
    }

    it 'fails to accept unkown value for a given parameter key' do
      actual = { 'param_a' => 'x' }
      expect {
        validator.assert_valid_values(permitted, actual)
      }.to raise_error(Github::Error::UnknownValue)
    end

    it 'accepts known value for a given parameter key' do
      actual = { 'param_a' => 'a'}
      validator.assert_valid_values(permitted, actual)
    end

    it 'fails to match regex value for a given parameter key' do
      actual = { 'param_b' => 'xgithub' }
      expect {
        validator.assert_valid_values(permitted, actual)
      }.to raise_error(Github::Error::UnknownValue)
    end

    it 'matches regex value for a given parameter key' do
      actual = { 'param_b' => 'github'}
      validator.assert_valid_values(permitted, actual)
    end
  end

end # Github::Validations::Format

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/validations/format_spec.rb
github_api-0.11.2 spec/github/validations/format_spec.rb
github_api-0.11.1 spec/github/validations/format_spec.rb
github_api-0.11.0 spec/github/validations/format_spec.rb
github_api-0.10.2 spec/github/validations/format_spec.rb
github_api-0.10.1 spec/github/validations/format_spec.rb
github_api-0.10.0 spec/github/validations/format_spec.rb
github_api-0.9.7 spec/github/validations/format_spec.rb
github_api-0.9.6 spec/github/validations/format_spec.rb
github_api-0.9.5 spec/github/validations/format_spec.rb
github_api-0.9.4 spec/github/validations/format_spec.rb
github_api-0.9.3 spec/github/validations/format_spec.rb
github_api-0.9.2 spec/github/validations/format_spec.rb
github_api-0.9.1 spec/github/validations/format_spec.rb
github_api-0.9.0 spec/github/validations/format_spec.rb
github_api-0.8.11 spec/github/validations/format_spec.rb
github_api-0.8.10 spec/github/validations/format_spec.rb
github_api-0.8.9 spec/github/validations/format_spec.rb
github_api-0.8.8 spec/github/validations/format_spec.rb
github_api-0.8.7 spec/github/validations/format_spec.rb