Sha256: 7ceaf135e7f16870ebf3b8aa4747aa51308d050b00bb6f908f7ce5ce9838621d
Contents?: true
Size: 1.3 KB
Versions: 5
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe RenderingController do let(:parsed_response) do JSON.parse(response.body) end describe 'GET index' do render_views let(:documents_count) { Random.rand(2..5) } let(:expected_content) do documents.map do |document| "<li><strong>Name:</strong>#{document.name}</li>" end.join("\n ") end let!(:documents) { create_list(:document, documents_count) } context 'when calling on format html' do before do get :index, params: { format: :html } end it { expect(response).to be_successful } it { expect(response).to render_template('rendering/index') } it { expect(response.body).to include(expected_content) } end end describe 'GET show' do render_views let(:document) { create(:document) } let(:document_id) { document.id } let(:expected_content) do "<p><strong>Name:</strong>#{document.name}</p>" end context 'when calling on format html' do before do get :show, params: { id: document.id, format: :html } end it { expect(response).to be_successful } it { expect(response).to render_template('rendering/show') } it { expect(response.body).to include(expected_content) } end end end
Version data entries
5 entries across 5 versions & 1 rubygems