Sha256: 3b31617557b0af5c03fd55733bb46d4adf82601e5ec0636f0f8749af3404e3e5

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require_relative '../spec_helper'

# Load the class under test
require_relative '../../lib/sequitur/digram'

module Sequitur # Re-open the module to get rid of qualified names

describe Digram do
  let(:two_symbols) { [:b, :c] }
  let(:production) { double('sample-production') }

  context 'Standard creation & initialization:' do
  
    it 'should be created with 3 arguments' do
      instance = Digram.new(:b, :c, production)
      
      expect(instance.symbols).to eq(two_symbols)
      expect(instance.production).to eq(production)
    end
    
    it 'should return the production that it refers to' do
      instance = Digram.new(:b, :c, production)
      expect(instance.production).to eq(production)
    end

  end # context

  context 'Standard creation & initialization:' do
  
    it 'should compare itself to another digram' do
      instance1 = Digram.new(:a, :b, production)
      same = Digram.new(:a, :b, production)
      different = Digram.new(:b, :c, production)
      
      expect(instance1).to eq(instance1)
      expect(instance1).to eq(same)
      expect(instance1).not_to eq(different)
      expect(same).not_to eq(different)       
    end
  
  end # context
  

end # describe

end # module

# End of file

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sequitur-0.1.02 spec/sequitur/digram_spec.rb
sequitur-0.0.14 spec/sequitur/digram_spec.rb
sequitur-0.0.13 spec/sequitur/digram_spec.rb
sequitur-0.0.12 spec/sequitur/digram_spec.rb