Sha256: 75a3d62c35f867e0a16475ac236703a382fa00998196e0d222c7cb3dfb30d691

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

Stored size: 759 Bytes

Contents

require 'spec_helper'
require 'sewell'

describe Sewell do
  it 'raise TypeError unless input String' do
    lambda{Sewell.generate [], []}.should raise_error(TypeError)
  end

  it 'can generate from string' do
    Sewell.generate('sena:airi OR mashiro AND nuko:buta', %w{sena uryu nuko}).should == '( sena:@airi ) OR ( sena:@mashiro OR uryu:@mashiro OR nuko:@mashiro ) + ( nuko:@buta )'
    Sewell.generate('-inui airi', ['mashiro']).should == '( mashiro:@airi ) - ( mashiro:@inui )'
  end

  it 'can generate from hash' do
    Sewell.generate({sena: 'airi OR huro', nuko: 'trape'}, 'AND').should == '( sena:@airi OR sena:@huro ) + ( nuko:@trape )'
    Sewell.generate({mashiro: '-inui airi'}, 'AND').should == '( mashiro:@airi - mashiro:@inui )'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sewell-1.0.1 spec/sewell/sewell_spec.rb
sewell-1.0.0 spec/sewell/sewell_spec.rb
sewell-0.1.4 spec/sewell/sewell_spec.rb
sewell-0.1.3 spec/sewell/sewell_spec.rb
sewell-0.1.2 spec/sewell/sewell_spec.rb
sewell-0.1.1 spec/sewell/sewell_spec.rb