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.8.2 spec/github/validations/presence_spec.rb
github_api-0.8.1 spec/github/validations/presence_spec.rb
github_api-0.8.0 spec/github/validations/presence_spec.rb
github_api-0.7.2 spec/github/validations/presence_spec.rb
github_api-0.7.1 spec/github/validations/presence_spec.rb