Sha256: f926af4cc984430366795a31e53a2102b2b85f8d54885e480bddc95a65223bb6

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Evaluator::Context, '#respond_to?' do
  subject { object.respond_to?(method, include_private) }

  let(:attribute) { Attribute::Integer.new(:id)         }
  let(:header)    { Relation::Header.new([ attribute ]) }
  let(:object)    { described_class.new(header) {}      }

  context 'when the method is an attribute name and include_private is true' do
    let(:method)          { attribute.name }
    let(:include_private) { true           }

    it { should be(true) }
  end

  context 'when the method is an attribute name and include_private is false' do
    let(:method)          { attribute.name }
    let(:include_private) { false          }

    it { should be(true) }
  end

  context 'when the method is not an attribute name and include_private is true' do
    let(:method)          { :unknown }
    let(:include_private) { true     }

    it { should be(false) }
  end

  context 'when the method is not an attribute name and include_private is false' do
    let(:method)          { :unknown }
    let(:include_private) { false    }

    it { should be(false) }
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/evaluator/context/respond_to_predicate_spec.rb
veritas-0.0.7 spec/unit/veritas/evaluator/context/respond_to_spec.rb
veritas-0.0.6 spec/unit/veritas/evaluator/context/respond_to_spec.rb