Sha256: 8b38fb756bba9048437f956a430835b0e8885bbd210f0aa1ea0861efbe024784

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

require "spec_helper"

module Refinery
  describe PaginationHelper, :type => :helper do

    describe "#pagination_css_class" do
      context "when request.xhr? and params[:from_page] is set" do
        before do
          allow(controller.request).to receive(:xhr?).and_return(true)
        end

        context "when params[:from_page] > params[:page] or 1" do
          it "does something" do
            allow(helper).to receive(:params).and_return({:from_page => 2, :page => 1})
            expect(helper.pagination_css_class).to eq("frame_left")
          end
        end

        context "when params[:from_page] < params[:page] or 1" do
          it "returns frame_right" do
            allow(helper).to receive(:params).and_return({:from_page => 1, :page => 1})
            expect(helper.pagination_css_class).to eq("frame_right")
          end
        end
      end

      context "when request.xhr? and params[:from_page] isn't set" do
        it "returns frame_center" do
          expect(helper.pagination_css_class).to eq("frame_center")
        end
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
refinerycms-core-4.0.3 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-4.0.2 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-4.0.1 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-3.0.6 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-4.0.0 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-3.0.5 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-3.0.4 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-3.0.3 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-3.0.2 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-3.0.1 spec/helpers/refinery/pagination_helper_spec.rb
refinerycms-core-3.0.0 spec/helpers/refinery/pagination_helper_spec.rb