Sha256: 910207c6c1784b4464589fc2c9137cebd3968573a0821e96ba9e50a5dae61d59

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

require 'spec_helper'

describe Spree::StaticContentController, type: :controller do
  let!(:store) { create(:store, default: true) }

  context '#show' do
    it 'accepts path as root' do
      page = create(:page, slug: '/', stores: [store])
      request.path = page.slug
      get :show, params: { path: page.slug }
      expect(response).to be_successful
    end

    it 'accepts path as string' do
      page = create(:page, slug: 'hello', stores: [store])
      request.path = page.slug
      get :show, params: { path: page.slug }
      expect(response).to be_successful
    end

    it 'accepts path as nested' do
      page = create(:page, slug: 'aa/bb/cc', stores: [store])
      request.path = page.slug
      get :show, params: { path: page.slug }
      expect(response).to be_successful
    end

    it 'respond with a 404 when no page exists' do
      expect {
        get :show
      }.to raise_error(ActiveRecord::RecordNotFound)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_static_content-2.0.0 spec/controllers/spree/static_content_controller_spec.rb