Sha256: ddabc8207f0b8fcd8f922991d618dab10eb3e037b2c88746b5bf3f495a011216

Contents?: true

Size: 921 Bytes

Versions: 4

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

describe Alchemy::Admin::ContentsController do

  before(:each) do
    activate_authlogic
    Alchemy::UserSession.create Factory(:admin_user)
  end

  it "should update a content via ajax" do
    @element = Factory(:element)
    post :update, {:id => @element.contents.find_by_name('intro').id, :content => {:body => 'Peters Petshop'}, :format => :js}
    @element.ingredient('intro').should == "Peters Petshop"
  end

  describe "#order" do

    context "with content_ids in params" do

      before(:each) do
        @element = Factory(:element)
      end

      it "should reorder the contents" do
        content_ids = @element.contents.essence_texts.collect(&:id)
        post :order, {:content_ids => content_ids.reverse, :format => :js}
        response.status.should == 200
        @element.contents.essence_texts.collect(&:id).should == content_ids.reverse
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alchemy_cms-2.2.rc6 spec/controllers/admin/contents_controller_spec.rb
alchemy_cms-2.2.rc3 spec/controllers/admin/contents_controller_spec.rb
alchemy_cms-2.2.rc2 spec/controllers/admin/contents_controller_spec.rb
alchemy_cms-2.2.rc1 spec/controllers/admin/contents_controller_spec.rb