Sha256: bb38038acfbdc65fe9ba704a4cafd06cdccef6cd64fb43bd4527ef7571ed68a2

Contents?: true

Size: 851 Bytes

Versions: 9

Compression:

Stored size: 851 Bytes

Contents

require 'spec_helper'

describe Datagrid::Scaffold do
  subject { Datagrid::Scaffold.new(["user"]) }


  describe '.pagination_helper_code' do
    it 'uses kaminari by default' do
      expect(subject.pagination_helper_code).to eql('paginate(@grid.assets)')
    end

    context "when WillPaginate exists" do
      before(:each) do
        Object.const_set("WillPaginate", 1)
      end
      it 'uses willpaginate' do
        expect(subject.pagination_helper_code).to eql('will_paginate(@grid.assets)')
      end

      after(:each) do
        Object.send(:remove_const, "WillPaginate")
      end
    end
  end

  describe ".index_action" do

    it "works" do
      expect(subject.index_action).to eq(<<-RUBY)
  def index
    @grid = UsersGrid.new(params[:users_grid]) do |scope|
      scope.page(params[:page])
    end
  end
RUBY
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
datagrid-1.5.6 spec/datagrid/scaffold_spec.rb
datagrid-1.5.5 spec/datagrid/scaffold_spec.rb
datagrid-1.5.4 spec/datagrid/scaffold_spec.rb
datagrid-1.5.3 spec/datagrid/scaffold_spec.rb
datagrid-1.5.2 spec/datagrid/scaffold_spec.rb
datagrid-1.5.1 spec/datagrid/scaffold_spec.rb
datagrid-1.5.0 spec/datagrid/scaffold_spec.rb
datagrid-1.4.4 spec/datagrid/scaffold_spec.rb
datagrid-1.4.3 spec/datagrid/scaffold_spec.rb