Sha256: 823b94a6306ed7ca4318ca7a35dbc9b15bf39de4ad161546182c710b8f40e11e

Contents?: true

Size: 806 Bytes

Versions: 1

Compression:

Stored size: 806 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Function::Unary::Invertible, '#inverse' do
  subject { object.inverse }

  let(:described_class) { Class.new(Function) { include Function::Unary } }
  let(:operand)         { mock('Operand').freeze                          }
  let(:object)          { described_class.new(operand)                    }

  before do
    described_class.class_eval do
      include Function::Unary::Invertible

      def self.inverse
        self
      end

      def inspect
        'Unary::Invertible'
      end
    end
  end

  it_should_behave_like 'an idempotent method'

  it { should be_kind_of(described_class) }

  it { should_not equal(object) }

  its(:operand) { should equal(operand) }

  it 'is invertible' do
    subject.inverse.should equal(object)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.4 spec/unit/veritas/function/unary/invertible/inverse_spec.rb