Sha256: 4a05aa44f4a2d2bb855a2fb25c7b81c818e16cedc383d8e94edb923f8911d5ac
Contents?: true
Size: 1.44 KB
Versions: 13
Compression:
Stored size: 1.44 KB
Contents
require 'spec_helper' describe Alchemy::Admin::ContentsController do before(:each) do activate_authlogic Alchemy::UserSession.create FactoryGirl.create(:admin_user) end describe '#create' do let(:element) { FactoryGirl.create(:element, :name => 'headline') } it "should create a content via ajax post" do length_before = element.contents.length post :create, {:content => {:element_id => element.id, :name => 'headline'}, :format => :js} element.contents.reload element.contents.length.should == length_before + 1 end end describe '#update' do it "should update a content via ajax" do @element = FactoryGirl.create(:element, :create_contents_after_create => true) post :update, {:id => @element.contents.find_by_name('intro').id, :content => {:body => 'Peters Petshop'}, :format => :js} @element.ingredient('intro').should == "Peters Petshop" end end describe "#order" do context "with content_ids in params" do before(:each) do @element = FactoryGirl.create(:element, :create_contents_after_create => true) 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
13 entries across 13 versions & 1 rubygems