Sha256: 4384a48a1b57346c568c2151ef2b383359615a24372c8015f4babb33923c7d32

Contents?: true

Size: 871 Bytes

Versions: 12

Compression:

Stored size: 871 Bytes

Contents

require 'spec_helper'

describe ActiveAdmin::ResourceController::Collection do
  let(:params) do
    {}
  end

  let(:controller) do
    rc = Admin::PostsController.new
    rc.stub!(:params) do
      params
    end
    rc
  end

  describe ActiveAdmin::ResourceController::Collection::Search do
    let(:params){ {:q => {} }}
    it "should call the metasearch method" do
      chain = mock("ChainObj")
      chain.should_receive(:metasearch).with(params[:q]).once.and_return(Post.search)
      controller.send :search, chain
    end
  end

  describe ActiveAdmin::ResourceController::Collection::Sorting do
    let(:params){ {:order => "id_asc" }}
    it "should prepend the table name" do
      chain = mock("ChainObj")
      chain.should_receive(:order).with("\"posts\".id asc").once.and_return(Post.search)
      controller.send :sort_order, chain
    end
  end

end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
activeadmin-0.4.0 spec/unit/resource_controller/collection_spec.rb
andrewroth_activeadmin-0.3.4.4 spec/unit/resource_controller/collection_spec.rb
andrewroth_activeadmin-0.3.4.3 spec/unit/resource_controller/collection_spec.rb
andrewroth_activeadmin-0.3.4.2 spec/unit/resource_controller/collection_spec.rb
andrewroth_activeadmin-0.3.4.1 spec/unit/resource_controller/collection_spec.rb
andrewroth_activeadmin-0.3.4 spec/unit/resource_controller/collection_spec.rb
activeadmin-0.3.4 spec/unit/resource_controller/collection_spec.rb
activeadmin-0.3.3 spec/unit/resource_controller/collection_spec.rb
activeadmin-0.3.2 spec/unit/resource_controller/collection_spec.rb
activeadmin-0.3.1 spec/unit/resource_controller/collection_spec.rb
activeadmin-0.3.0 spec/unit/resource_controller/collection_spec.rb
nsm-activeadmin-0.2.2 spec/unit/resource_controller/collection_spec.rb