Sha256: 1b9634f1ccf7d7bc8d6523dcff7195e6008d07af9d1eaaf02c5e64c4a09d6d2b

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

require 'models/app_config'

RSpec.describe AppConfig do
  context 'Configuration set' do
    let(:content) do
      <<-CONTENT
---
site:
  description: this is **awesome**
  user: Test User
  site_map: >
    [hello][h]

    [h]: http://hello.world
CONTENT
    end

    let(:config) { AppConfig.new(content) }

    describe '#site_map' do
      it 'returns site map in html' do
        expect(config.site_map).to eq('<p><a href="http://hello.world">hello</a></p>')
      end
    end

    describe '#site_description' do
      it 'returns site description in html' do
        expect(config.site_description).to eq('<p>this is <strong>awesome</strong></p>')
      end
    end

    describe '#user' do
      it 'returns user name' do
        expect(config.user).to eq('Test User')
      end
    end
  end

  context 'Configuration not set' do
    let(:content) do
      <<-CONTENT
---
CONTENT
    end

    let(:config) { AppConfig.new(content) }

    describe '#site_map' do
      it 'returns empty string' do
        expect(config.site_map).to eq('')
      end
    end

    describe '#site_description' do
      it 'returns empty string' do
        expect(config.site_description).to eq('')
      end
    end

    describe '#user' do
      it 'returns empty string' do
        expect(config.user).to eq('')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ignoramos-1.1.0 spec/models/app_config_spec.rb
ignoramos-1.0.1 spec/models/app_config_spec.rb
ignoramos-1.0.0 spec/models/app_config_spec.rb