Sha256: 364f0ab0813e913556030707593c9274a4eef519b707ff6f929f4913ad87ad4f

Contents?: true

Size: 1.06 KB

Versions: 60

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Picky::Query::QualifierCategoryMapper do
  
  let(:mapper) { described_class.new }
  before(:each) do
    @category1 = stub(:category1, :qualifiers => ['t1', 'tt1', 'ttt1'])
    @category2 = stub(:category2, :qualifiers => [:t2, :tt2, :ttt2])
    @category3 = stub(:category3, :qualifiers => [:t3, :tt3, :ttt3])
    mapper.add @category1
    mapper.add @category2
    mapper.add @category3
  end
  
  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

60 entries across 60 versions & 1 rubygems

Version Path
picky-4.0.4 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.3 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.1 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.0 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.0pre6 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.0pre5 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.0pre3 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.0pre2 spec/lib/query/qualifier_category_mapper_spec.rb
picky-4.0.0pre1 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.16 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.15 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.14 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.13 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.12 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.11 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.10 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.9 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.8 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.7 spec/lib/query/qualifier_category_mapper_spec.rb
picky-3.6.6 spec/lib/query/qualifier_category_mapper_spec.rb