Sha256: 683b96296afee78798953b868d8b51c560e0ef76f6604eec25d2e556cff1fa0a

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8
require 'spec_helper'

module BusinessCatalyst
  module CSV

    describe CatalogTransformer do
      subject { CatalogTransformer }
      it "prepends and joins catalogs with '/'" do
        subject.transform(["A", "B"]).should eq("/A/B")
      end
      it "joins multiple categorizations with ';'" do
        subject.transform( [["A", "B"], ["C", "D"]] ).should eq("/A/B;/C/D")
      end
      it "treats a single string as one catalog" do
        subject.transform("A").should eq("/A")
      end
      it "replaces slashes with a space" do
        subject.transform("One/Two").should eq("/One Two")
      end
      it "replaces semi-colons with a space" do
        subject.transform("One;Two").should eq("/One Two")
      end
      it "squishes multiple spaces" do
        subject.transform("A  B").should eq("/A B")
      end
      it "converts all whitespace characters to single space" do
        subject.transform("A\n\nB").should eq("/A B")
      end

      it "it joins multiple catalog path arrays with ';'" do
        subject.transform([["Abrasives"], ["Abrasives", "Sleeves"]]).should eq("/Abrasives;/Abrasives/Sleeves")
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
business_catalyst-0.1.2 spec/lib/business_catalyst/csv/transformers/catalog_transformer_spec.rb
business_catalyst-0.1.1 spec/lib/business_catalyst/csv/transformers/catalog_transformer_spec.rb
business_catalyst-0.1.0 spec/lib/business_catalyst/csv/transformers/catalog_transformer_spec.rb