Sha256: fc33425a3d9a8de9a97f66f8df2e399e844efb7e322350fe42c25efe5a70cd53

Contents?: true

Size: 1.12 KB

Versions: 42

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Picky::Query::QualifierCategoryMapper do
  
  let(:index) do
    categories = Picky::Index.new :categories
    @category1 = categories.category :category1, :qualifiers => ['t1', 'tt1', 'ttt1']
    @category2 = categories.category :category2, :qualifiers => [:t2, :tt2, :ttt2]
    @category3 = categories.category :category3, :qualifiers => [:t3, :tt3, :ttt3]
    categories
  end
  let(:indexes) { [index] }
  let(:mapper) { described_class.new indexes }
  
  def self.it_should_map(qualifier, expected)
    it "should map #{qualifier} to #{expected}" do
      mapper.map(qualifier).should == expected
    end
  end

  describe "mapping" do
    it { mapper.map(:t1).should   == @category1 }
    it { mapper.map(:tt1).should  == @category1 }
    it { mapper.map(:ttt1).should == @category1 }
    
    it { mapper.map(:t2).should   == @category2 }
    it { mapper.map(:tt2).should  == @category2 }
    it { mapper.map(:ttt2).should == @category2 }
    
    it { mapper.map(:t3).should   == @category3 }
    it { mapper.map(:tt3).should  == @category3 }
    it { mapper.map(:ttt3).should == @category3 }
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
picky-4.10.0 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.9.0 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.8.1 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.8.0 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.7.0 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.6.6 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.6.5 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.6.4 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.6.3 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.6.2 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.6.1 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.6.0 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.12 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.11 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.10 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.9 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.8 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.7 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.6 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.5.5 spec/lib/query/qualifier_category_mapper_spec.rb