Sha256: dda9420d0fc7b3d28e6c8685dfd9c2a62f8ca11891861503dd81430fd65cb297
Contents?: true
Size: 709 Bytes
Versions: 1
Compression:
Stored size: 709 Bytes
Contents
require 'spec_helper' describe SortableController, type: :controller do describe "POST reorder" do before do @item1 = Item.create! @item2 = Item.create! @item3 = Item.create! end it "should reorder models" do if Gem::Version.new(Rails.version) < Gem::Version.new(5) post :reorder, rails_sortable: { Item: [@item1.id, @item3.id, @item2.id] } else post :reorder, params: { rails_sortable: { Item: [@item1.id, @item3.id, @item2.id] } } end expect(response.body).to be_blank expect(Item.find(@item1.id).sort).to eql 0 expect(Item.find(@item2.id).sort).to eql 2 expect(Item.find(@item3.id).sort).to eql 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_sortable-1.1.4 | spec/controllers/sortable_controller_spec.rb |