Sha256: 2ed46a0bc6da30c144ed33938504f1e3f92ad2060aeb932e3fcd61ee234cbced

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe ActiveMetadata::AttachmentsController do

  context "given 2 attachments for @document#name" do

    render_views

    before(:each) do
      @document = Document.create! { |d| d.name = "John" }
      (1..2).each do |i|
        @document.save_attachment_for(:name,test_pdf("pdf_test_#{i}"))
     end
    end

    describe "GET 'index'" do

      it "should success" do
        get 'index', :model_name => 'document', :model_id => @document.id, :field_name => 'name'
        response.should be_success
      end

      it "should assign attachments" do
        get 'index', :model_name => 'document', :model_id => @document.id, :field_name => 'name'
        assigns(:attachments).should_not be_nil
        assigns(:attachments).size.should eq 2
      end

      it "should display 3 notes" do
        get 'index', :model_name => 'document', :model_id => @document.id, :field_name => 'name'
        response.body.should match(/pdf_test_1.pdf/)
        response.body.should match(/pdf_test_2.pdf/)
      end

    end

  end


end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_metadata-0.7.0 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.9 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.7 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.6 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.5 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.4 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.3 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.2 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.1 spec/controllers/active_metadata/attachments_controller_spec.rb
active_metadata-0.6.0 spec/controllers/active_metadata/attachments_controller_spec.rb