Sha256: 2ef1756593ce8d02db71ccc3bb8f2d3bbb496468d4bb2c8d510680c841c88cc7

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 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

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.1 spec/unit/axiom/evaluator/context/respond_to_predicate_spec.rb