Sha256: aa74989d0e23313d5a7dec8c1e5dd7b8a25fe522743239e0c0c129e8bf4f12ae
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' describe Specification do let(:spec) { Specification.new 'dummy_spec.yml' } it 'List all labels' do combination = %w(A1 A2 A3 A0 B1 B2 B3 B0 C1 C2 C3 C0 01 02 03 00) all_labels = spec.categories.inject([]) do |labels, category| labels << combination.map { |c| "#{category.code}#{c}" } end.flatten spec.all_labels.should eq all_labels end it 'List labels with empty prefix' do list = spec.starts_with '' list.should eq spec.all_labels end it 'List labels with category prefix' do list = spec.starts_with '1' list.should eq %w(1A1 1A2 1A3 1A0 1B1 1B2 1B3 1B0 1C1 1C2 1C3 1C0 101 102 103 100) end it 'List labels with feature prefix' do list = spec.starts_with '1A' list.should eq %w(1A1 1A2 1A3 1A0) end it 'List tails from prefix' do list = spec.tails '1A' list.should eq %w(1 2 3 0) end it 'List next codes from prefix' do list = spec.next_codes '1A' list.should eq %w(1 2 3 0) end it 'Validate label' do spec.valid_label?('XXX').should be_false spec.valid_label?('1A1').should be_true end it 'Convert label to names' do list = spec.names_of '1A1' list.should eq %w(category_1 value_a value_1) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eagle_labels-0.0.1 | spec/specification_spec.rb |