Sha256: ef4bfd984c6df45f0f579f79aa042a30dd7bc7e0fdf4d5d960abb8c5da559860

Contents?: true

Size: 1.01 KB

Versions: 25

Compression:

Stored size: 1.01 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Validations::Presence do

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

  context '#assert_presence_of' do
    it 'checks hash with nil value' do
      user, repo = nil, 'github_api'
      expect {
        validator.assert_presence_of user, repo
      }.to raise_error(ArgumentError)
    end

    it 'asserts array without nil value' do
      user, repo = 'peter-murach', 'github_api'
      expect {
        validator.assert_presence_of user, repo
      }.to_not raise_error(ArgumentError)
    end

    it 'assert hash with nil value' do
      args = {:user => nil, :repo => 'github_api'}
      expect { validator.assert_presence_of args }.
        to raise_error(Github::Error::Validations)
    end

    it 'asserts hash without nil value' do
      args = {:user => 'peter-murach', :repo => 'github_api'}
      expect { validator.assert_presence_of args }.
        to_not raise_error(Github::Error::Validations)
    end
  end

end # Github::Validations::Presence

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
github_api-0.10.2 spec/github/validations/presence_spec.rb
github_api-0.10.1 spec/github/validations/presence_spec.rb
github_api-0.10.0 spec/github/validations/presence_spec.rb
github_api-0.9.7 spec/github/validations/presence_spec.rb
github_api-0.9.6 spec/github/validations/presence_spec.rb
github_api-0.9.5 spec/github/validations/presence_spec.rb
github_api-0.9.4 spec/github/validations/presence_spec.rb
github_api-0.9.3 spec/github/validations/presence_spec.rb
github_api-0.9.2 spec/github/validations/presence_spec.rb
github_api-0.9.1 spec/github/validations/presence_spec.rb
github_api-0.9.0 spec/github/validations/presence_spec.rb
github_api-0.8.11 spec/github/validations/presence_spec.rb
github_api-0.8.10 spec/github/validations/presence_spec.rb
github_api-0.8.9 spec/github/validations/presence_spec.rb
github_api-0.8.8 spec/github/validations/presence_spec.rb
github_api-0.8.7 spec/github/validations/presence_spec.rb
github_api-0.8.6 spec/github/validations/presence_spec.rb
github_api-0.8.5 spec/github/validations/presence_spec.rb
github_api-0.8.4 spec/github/validations/presence_spec.rb
github_api-0.8.3 spec/github/validations/presence_spec.rb