Sha256: 13c9d86cd3f88057239d594d2d5db8396a72b7d276d2e1656e1798c586fc13d1

Contents?: true

Size: 529 Bytes

Versions: 7

Compression:

Stored size: 529 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 "Item_#{new_item.id}"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_sortable-1.2.1 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.2.0 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.1.4 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.1.3 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.1.2 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.1.1 spec/helpers/sortable_helper_spec.rb
rails_sortable-1.1.0 spec/helpers/sortable_helper_spec.rb