Sha256: 2a6c84d891ecb4c62bd9236907fc628d0b4262a564e697237ea9449804ed45cc

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe ActiveMetadata::StreamController do

  context "given 1 note and 1 attachment for @document#name" do

    render_views

    before(:each) do
      @document = Document.create! { |d| d.name = "John" }
      @document.save_attachment_for(:name,test_pdf("pdf_test"))
      @document.create_note_for(:name, "nota per name john")
    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 document" do
        get 'index', :model_name => 'document', :model_id => @document.id, :field_name => 'name'
        assigns(:document).should_not be_nil
        assigns(:document).id.should eq @document.id
      end

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

      it "should render both note and the attachment" do
        get 'index', :model_name => 'document', :model_id => @document.id, :field_name => 'name'
        response.body.should match(/pdf_test.pdf/)
        response.body.should match(/nota per name john/)
      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/stream_controller_spec.rb
active_metadata-0.6.9 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.7 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.6 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.5 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.4 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.3 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.2 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.1 spec/controllers/active_metadata/stream_controller_spec.rb
active_metadata-0.6.0 spec/controllers/active_metadata/stream_controller_spec.rb