Sha256: 9a9553a1c272db0f70cc73d1744dd270eaed620aa7cc0abc4f9e2e203f2426d1

Contents?: true

Size: 495 Bytes

Versions: 3

Compression:

Stored size: 495 Bytes

Contents

require "spec_helper"

describe Emites::Params do
  let(:permitted_params) { [:a, :b, :c] }
  subject { Emites::Params.new(permitted_params) }

  describe '#permit' do

    it 'filters a hash with string keys' do
      expect(Emites::Params.new({'a' => 1, 'b' => 2, 'd' => 3 }).permit(permitted_params)).to eq({ a: 1, b: 2 })
    end

    it 'filters a hash with symbol keys' do
      expect(Emites::Params.new(a: 1, b: 2, d: 3).permit(permitted_params)).to eq({ a: 1, b: 2 })
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
emites-client-0.1.4 spec/emites/params_spec.rb
emites-client-0.1.3 spec/emites/params_spec.rb
emites-client-0.1.2 spec/emites/params_spec.rb