Sha256: 916bfa5c52a3f9e8e4185ab0ce20301bad74ecc99e606348d08f149fc7b909a4
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
require 'spec_helper' require 'mail/fields/common/parameter_hash' describe Mail::ParameterHash do it "should return the values in the hash" do hash = Mail::ParameterHash.new hash.merge!({'value1' => 'one', 'value2' => 'two'}) hash.keys.should == ['value1', 'value2'] hash.values.should == ['one', 'two'] end it "should return the values in the hash regardless of symbol or string" do hash = Mail::ParameterHash.new hash.merge!({'value1' => 'one', 'value2' => 'two'}) hash['value1'].should == 'one' hash['value2'].should == 'two' hash[:value1].should == 'one' hash[:value2].should == 'two' end it "should return the correct value if they are not encoded" do hash = Mail::ParameterHash.new hash.merge!({'value1' => 'one', 'value2' => 'two'}) hash['value1'].should == 'one' hash['value2'].should == 'two' end it "should return a name list concatenated" do hash = Mail::ParameterHash.new hash.merge!({'value*1' => 'one', 'value*2' => 'two'}) hash['value'].should == 'onetwo' end it "should return a name list concatenated and unencoded" do hash = Mail::ParameterHash.new hash.merge!({'value*0*' => "us-ascii'en'This%20is%20even%20more%20", 'value*1*' => "%2A%2A%2Afun%2A%2A%2A%20", 'value*2' => "isn't it"}) hash['value'].should == "This is even more ***fun*** isn't it" end it "should allow us to add a value" do hash = Mail::ParameterHash.new hash['value'] = 'bob' hash['value'].should == 'bob' end it "should return an encoded value" do hash = Mail::ParameterHash.new hash.merge!({'value*0*' => "us-ascii'en'This%20is%20even%20more%20", 'value*1*' => "%2A%2A%2Afun%2A%2A%2A%20", 'value*2' => "isn't it"}) hash.encoded.should == %Q{value*0*=us-ascii'en'This%20is%20even%20more%20;\r\n\tvalue*1*=%2A%2A%2Afun%2A%2A%2A%20;\r\n\tvalue*2="isn't it"} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-mail_exception-0.0.1 | vendor/mail/spec/mail/fields/common/parameter_hash_spec.rb |