Sha256: b989f49060a51f458d6488bc1eb511e2b18e81dfc753982e234b305ffdf4855a

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

require 'spec_helper'

describe Zertico::PermittedParams do
  let(:user) { User.new }
  let(:params) { ActionController::Parameters.new(:user => { :id => 1, :name => "name" }) }
  let(:user_permitted_params) { UsersPermittedParams.new(params) }

  describe '#create' do
    it "should ignore the id" do
      expect(user_permitted_params.create).to eq({ 'name' => 'name' })
    end
  end

  describe '#update' do
    it "should ignore the name" do
      expect(user_permitted_params.update).to eq({ 'id' => 1 })
    end
  end

  describe '.interface_class' do
    it 'should return the interface singular name ' do
      expect(UsersPermittedParams.interface_class).to eq(User)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zertico-2.0.0.alpha.3 spec/zertico/permitted_params_spec.rb
zertico-2.0.0.alpha.2 spec/zertico/permitted_params_spec.rb
zertico-2.0.0.alpha.1 spec/zertico/permitted_params_spec.rb