Sha256: 1aa466ff4a41605b5ba62b62410892d149204c00b962d9aa223b7c51379eaf65

Contents?: true

Size: 972 Bytes

Versions: 8

Compression:

Stored size: 972 Bytes

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()
    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()
    end
  end

end # Github::Validations::Presence

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/validations/presence_spec.rb
github_api-0.12.2 spec/github/validations/presence_spec.rb
github_api-0.12.1 spec/github/validations/presence_spec.rb
github_api-0.12.0 spec/github/validations/presence_spec.rb
github_api-0.11.3 spec/github/validations/presence_spec.rb
github_api-0.11.2 spec/github/validations/presence_spec.rb
github_api-0.11.1 spec/github/validations/presence_spec.rb
github_api-0.11.0 spec/github/validations/presence_spec.rb