Sha256: da1d210958ebf878c58e62c0dcff275034d6947b3c73b657c811834831c909b5

Contents?: true

Size: 820 Bytes

Versions: 5

Compression:

Stored size: 820 Bytes

Contents

require 'spec_helper'

module ControllerResources
  RSpec.describe Extension do
    class MockController < ActionController::Base
      include Extension

      resource :model do
        search :name
        modify :name, :password
      end
    end

    subject { MockController }
    let(:controller) { subject.new }

    it "defines singleton and collection resources" do
      expect(subject._singleton_resource).to eq(:model)
      expect(subject._collection_resource).to eq(:models)
    end

    it "saves params" do
      expect(subject._search_params).to eq([:name])
      expect(subject._edit_params).to eq([:name, :password])
    end

    it "publishes params to instance method" do
      expect(controller).to respond_to(:search_params)
      expect(controller).to respond_to(:edit_params)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
controller_resources-0.0.5 spec/controller_resources/extension_spec.rb
controller_resources-0.0.4 spec/controller_resources/extension_spec.rb
controller_resources-0.0.3 spec/controller_resources/extension_spec.rb
controller_resources-0.0.2 spec/controller_resources/extension_spec.rb
controller_resources-0.0.1 spec/controller_resources/extension_spec.rb