Sha256: 33656515274cf0c4d5024cd306cc79452ad425d750b5e75a1c42828ffa87d8c5
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
describe Convoy::Utils do describe '::symbolize_keys' do subject { Convoy::Utils.symbolize_keys(hash) } context "when single level hash" do let(:hash) { { 'a' => 1, :b => 2 } } it("the :a key should be a symbol") { subject[:a].should == 1 } it("the :b key should be a symbol") { subject[:b].should == 2 } end context "when hash has nested hashes" do let(:hash) { { 'a' => 1, :b => { 'c' => { 'd' => 2 } } } } it("the :a key should be a symbol") { subject[:a].should == 1 } it("the nested keys, :b, :c and :d should all be symbols") { subject[:b][:c][:d].should == 2 } end end describe '::tokenize_option_string' do subject { Convoy::Utils.tokenize_option_string(option_string) } context "when option string has short option, long option and argument" do let(:option_string) { "-a 1 --foo='bar blah' yadda" } it("tokenized string should have 4 values") { subject.size.should == 4 } it("the short option should be a separate token") { subject[0].should == '-a' } it("the short option value should be a separate token") { subject[1].should == '1' } it("the long option and value should be one token") { subject[2].should == '--foo=bar blah' } it("the argument should be a separate token") { subject[3].should == 'yadda' } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
convoy-1.3.2 | spec/lib/convoy/utils_spec.rb |
convoy-1.2.0 | spec/lib/convoy/utils_spec.rb |