Sha256: c3cf56ad2bca1f4f18891fc35aa0afa030e0cb6f75efe0ff405bbb1e1c8874dc

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

require 'spec_helper'

describe SortableHelper, type: :helper do

  describe "#sortable_fetch" do

    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
        new_item = Item.create!
        sortable_fetch([ new_item ]) do |item, id|
          expect(item).to eq new_item
          expect(id).to eq SortableController::VERIFIER.generate("class=Item,id=#{new_item.id}")
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_sortable-1.3.2 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.3.1 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.3.0 spec/helpers/sortable_helper_spec.rb