Sha256: 0f2cc300eb825a39841bb436c84018fc6c37bf7a4cf3a6921ee64c6d84d7ac19
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' require 'cantango/configuration/shared/registry/hash_ex' describe CanTango::Configuration::Categories::Category do subject { CanTango::Configuration::Categories::Category.new } specify { subject.has_any?(:x).should_not be_true } subject { CanTango::Configuration::Categories::Category.new :a, :b } specify { subject.has_any?(:a).should be_true } end describe CanTango::Configuration::Categories do subject { CanTango.config.categories } describe 'API' do before(:each) do categories = {:a => ['B', 'C'], 'x' => ['Y', 'Z'], 'v' => ['B', 'Z']} subject.clean! subject.register categories end describe 'get index []' do specify { subject.register(:w => 'something non-array!') lambda { subject.category('w') }.should raise_error } end describe 'category_has_subject?' do specify { subject.category('a').has_any?('B').should be_true } end describe 'has_subject?' do specify { subject.has_any?('Y').should be_true } end describe 'category_names_of_subject' do specify { subject.category_names_of_subject('B').last.should == 'v' } specify { subject.category_names_of_subject('c').first.should == nil } end describe 'categories_of_subject' do specify do subject.categories_of_subject('B').should == {'a' => ['B', 'C'], 'v' => ['B', 'Z'],} end specify do subject.categories_of_subject('blip').should == {} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cantango-config-0.1.2 | spec/cantango/configuration/categories_spec.rb |
cantango-config-0.1.1 | spec/cantango/configuration/categories_spec.rb |