Sha256: e2a701dc1ef010218a92d983bd095d1f4785c0be313f65bbd48af96b0f442d1c

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

module CiteProc
  describe Attributes do
  
    before(:all) do
			A = Class.new { include Attributes }
		end
  
    let(:instance) do
			o = A.new
			o[:bar] = 'foo'
			o
		end

    let(:other) do
	 		o = A.new
			o[:foo] = 'bar'
			o
		end
  
    it { should_not be_nil }
  
    describe '.attr_fields' do
    
			#       before(:all) do
			# 	A.instance_eval { attr_fields :value, %w[ is-numeric punctuation-mode ] }
			# end

      it 'generates setters for attr_field values' do
        # pending
        # lambda { A.new.is_numeric }.should_not raise_error
      end
    
      it 'generates no other setters' do
        expect { A.new.some_other_value }.to raise_error
      end
    end
  
    describe '#merge' do    
    
      it 'merges non-existent values from other object' do
        expect(A.new.merge(other)[:foo]).to eq('bar')
      end
    
      it 'does not overwrite existing values when merging other object' do
        expect(instance.merge(other)[:bar]).to eq('foo')
      end
    
    end
  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citeproc-1.0.2 spec/citeproc/attributes_spec.rb