Sha256: 63d1aba9e3cdd1dea516125f7800fa9119bb360f1cbf31ece2a4e3f56e4b421d

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

require 'spec_helper'

def form_params(p)
  if Rails::VERSION::MAJOR > 4
    {params: p}
  else
    p
  end
end

describe Apress::Documentation::DocumentsController, type: :controller do
  after do
    Apress::Documentation.data.clear
  end

  describe '#show' do
    before do
      Apress::Documentation.build(:docs) do
        document(:doc1, title: 'test')
      end
    end

    context 'without params' do
      it 'response with 200' do
        get :show

        expect(assigns(:document)).to be_nil
        expect(response).to have_http_status(:ok)
      end
    end

    context 'with path' do
      it 'response with 200' do
        get :show, form_params(path: 'docs/doc1')

        expect(assigns(:document).title).to eq 'test'

        expect(response).to have_http_status(:ok)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apress-documentation-0.4.0 spec/app/controllers/documents_controller_spec.rb