Sha256: 49abaf554ad217590cc95b4def52778c0abbf9c2a85eb19e9af2a5b8a9d6ad1e

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 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

3 entries across 3 versions & 2 rubygems

Version Path
saulolso-activeadmin-0.2.2.1 spec/unit/resource_controller/collection_spec.rb
saulolso-activeadmin-0.2.2 spec/unit/resource_controller/collection_spec.rb
activeadmin-0.2.2 spec/unit/resource_controller/collection_spec.rb