Sha256: bb4bc79b5f893b9694011bda3582f9709feca051dce20675c9669954c51f53ed
Contents?: true
Size: 1.51 KB
Versions: 18
Compression:
Stored size: 1.51 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper")) require "usher" describe Usher::Splitter, "#split" do describe "when there are single-character delimiters" do it "should split correctly" do Usher::Splitter.for_delimiters(['.', '/']).split('/one/two.three/').should == ['/', 'one', '/', 'two', '.', 'three', '/'] end end describe "when there are multi-character delimiters" do it "should split correctly" do Usher::Splitter.for_delimiters(['/', '%28', '%29']).split('/one%28two%29three/').should == ['/', 'one', '%28', 'two', '%29', 'three', '/'] end end describe "when there is no delimiter in the end" do it "should split correctly" do Usher::Splitter.for_delimiters(['.', '/']).split('/one/two.three').should == ['/', 'one', '/', 'two', '.', 'three'] end end describe "when there is no delimiter in the beginning" do it "should split correctly" do Usher::Splitter.for_delimiters(['.', '/']).split('one/two.three/').should == ['one', '/', 'two', '.', 'three', '/'] end end describe "when delimiters are consecutive" do it "should split correctly" do Usher::Splitter.for_delimiters(['/', '!']).split('/cheese/!parmesan').should == ['/', 'cheese', '/', '!', 'parmesan'] end end describe "when delimiters contain escaped characters" do it "should split correctly" do Usher::Splitter.for_delimiters(['/', '\(', '\)']).split('/cheese(parmesan)').should == ['/', 'cheese', '(', 'parmesan', ')'] end end end
Version data entries
18 entries across 18 versions & 1 rubygems