Sha256: a34c6c2f568d06fd6f24517e58e09d84f816b4cf87abdf80df5c0e7282a183e5

Contents?: true

Size: 1022 Bytes

Versions: 12

Compression:

Stored size: 1022 Bytes

Contents

require 'spec_helper'

describe Postmark::HashHelper do
  describe ".to_postmark" do
    let(:source) { {:from => "support@postmarkapp.com", :reply_to => "contact@wildbit.com"} }
    let(:target) { {"From" => "support@postmarkapp.com", "ReplyTo" => "contact@wildbit.com"} }

    it 'converts Hash keys to Postmark format' do
      expect(subject.to_postmark(source)).to eq target
    end

    it 'acts idempotentely' do
      expect(subject.to_postmark(target)).to eq target
    end
  end

  describe ".to_ruby" do
    let(:source) { {"From" => "support@postmarkapp.com", "ReplyTo" => "contact@wildbit.com"} }
    let(:target) { {:from => "support@postmarkapp.com", :reply_to => "contact@wildbit.com"} }

    it 'converts Hash keys to Ruby format' do
      expect(subject.to_ruby(source)).to eq target
    end

    it 'has compatible mode' do
      expect(subject.to_ruby(source, true)).to eq target.merge(source)
    end

    it 'acts idempotentely' do
      expect(subject.to_ruby(target)).to eq target
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
postmark-1.21.7 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.21.6 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.21.5 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.21.4 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.21.3 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.21.2 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.21.1 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.21.0 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.20.0 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.19.2 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.19.1 spec/unit/postmark/helpers/hash_helper_spec.rb
postmark-1.19.0 spec/unit/postmark/helpers/hash_helper_spec.rb