Sha256: 4947b14f2b86baa862d42ff1b1f4e1b95739a9d852e76fe9f5cdb080bf60555a

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

Contents

require 'spec_helper'
require 'fixtures/project/config/application'

RSpec.describe Rail::Application do
  subject { Project::Application.new }

  describe '#call' do
    context 'when index.html exists' do
      before do
        allow(File).to receive(:exist?).and_return(true)
      end

      ['/', '/index.html'].each do |path|
        it "lets the browser serve #{path}" do
          expect(subject.browser).to receive(:process)
          expect(subject.pipeline).not_to receive(:process)

          subject.call('PATH_INFO' => path)
        end
      end
    end

    context 'when index.html does not exist' do
      before do
        allow(File).to receive(:exist?).and_return(false)
      end

      ['/', '/index.html'].each do |path|
        it "lets the pipeline serve #{path}" do
          expect(subject.browser).not_to receive(:process)
          expect(subject.pipeline).to receive(:process)

          subject.call('PATH_INFO' => path)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rail-0.1.1 spec/lib/rail/application_spec.rb
rail-0.1.0 spec/lib/rail/application_spec.rb
rail-0.0.8 spec/lib/rail/application_spec.rb