Sha256: 3bf6f85077a032b89d606594373228cca25779f0d9c59df4dbfdd879fabe3a92

Contents?: true

Size: 1.46 KB

Versions: 28

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe Admin::PageAttachmentsController do
  dataset :users, :home_page, :assets
  integrate_views
  
  it "should be a ResourceController" do
    controller.should be_kind_of(Admin::ResourceController)
  end
  
  it "should handle PageAttachments" do
    controller.class.model_class.should == PageAttachment
    controller.send(:model_symbol).should == :page_attachment
  end

  describe "on call to new" do
    before :each do
      login_as :existing
      @asset = assets(:video)
    end

    describe "with valid asset id" do
      it "should return a nested form for asset-attachment" do
        xhr :get, :new, :page_id => page_id(:home), :asset_id => @asset.id
        response.should be_success
        response.should render_template('admin/page_attachments/_attachment')
        response.body.should =~ /attachment_#{@asset.uuid}/
        response.body.should =~ /page_page_attachments_attributes_#{@asset.uuid}/
        response.body.should =~ /<input class="attacher"/
      end
    end

    describe "without asset id" do
      it "should respond blankly" do
        get :new, :format => :js
        response.should be_success
        response.body.should be_blank
      end
    end
    
    describe "with invalid asset id" do
      it "should respond blankly" do
        get :new, :asset_id => 'foo', :format => :js
        response.should be_success
        response.body.should be_blank
      end
    end
  end

end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
trusty-clipped-extension-2.0.2.pre.beta spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-2.0.1.pre.beta spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-2.0.0.pre.beta spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.1.1 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.1.0 spec/controllers/admin/page_attachments_controller_spec.rb
radiant-clipped-extension-1.1.2 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.11 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.10 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.9 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.8 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.7 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.6 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.5 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.4 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.3 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.2 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.1 spec/controllers/admin/page_attachments_controller_spec.rb
trusty-clipped-extension-1.0.0 spec/controllers/admin/page_attachments_controller_spec.rb
radiant-clipped-extension-add-group-1.1.2 spec/controllers/admin/page_attachments_controller_spec.rb
radiant-clipped-extension-1.1.1 spec/controllers/admin/page_attachments_controller_spec.rb