Sha256: 811d7ca8c807b7af6c26a5b50781f8cf4162bad0385647ba505e6f436f31e8cc

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe ActiveMetadata::NotesController do

  context "given 3 notes @document#name" do

    render_views

    before(:each) do
      @document = Document.create! { |d| d.name = "John" }
      (1..3).each do |i|
        @document.create_note_for(:name, "note#{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 notes" do
        get 'index', :model_name => 'document', :model_id => @document.id, :field_name => 'name'
        assigns(:notes).should_not be_nil
        assigns(:notes).size.should eq 3
      end

      it "should display 3 notes" do
        get 'index', :model_name => 'document', :model_id => @document.id, :field_name => 'name'
        response.body.should match(/note1/)
        response.body.should match(/note2/)
        response.body.should match(/note3/)
      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/notes_controller_spec.rb
active_metadata-0.6.9 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.7 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.6 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.5 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.4 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.3 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.2 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.1 spec/controllers/active_metadata/notes_controller_spec.rb
active_metadata-0.6.0 spec/controllers/active_metadata/notes_controller_spec.rb