Sha256: abe8d65b71a889d8a00b45b4d2cfaa3e367581376520dc3343d06277d17bc7a8

Contents?: true

Size: 573 Bytes

Versions: 1

Compression:

Stored size: 573 Bytes

Contents

require 'spec_helper'

describe SortableHelper, type: :helper do

  describe "#sortable_fetch" do

    class ARDummy
      alias_method :id, :object_id
    end

    context "with no block" do
      it { expect { helper.sortable_fetch(Array.new) }.to raise_error('Must be called with block!') }
    end

    context "with block" do
      it "should yield item and its object id" do
        obj = ARDummy.new
        sortable_fetch([ obj ]) do |item, id|
          expect(item).to eq obj
          expect(id).to eq "ARDummy_#{obj.id}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_sortable-1.0.0 spec/helpers/sortable_helper_spec.rb