Sha256: 95e182ec2c1c49609063c7b631440331ea5a54e9ed6fe8ff121ff0f6229a9639

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

require 'jekyll'
require 'jekyll_plugin_logger'
require 'liquid'
require 'fileutils'
require 'yaml'
require_relative '../lib/<%= @gem_name %>'

RSpec.configure do |config|
  config.filter_run :focus
  # config.order = 'random'
  config.run_all_when_everything_filtered = true

  # See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
  config.example_status_persistence_file_path = '../spec/status_persistence.txt'

  config.filter_run_when_matching focus: true
end

Registers = Struct.new(:page, :site)

# Mock for Collections
class Collections
  def values
    []
  end
end

# Mock for Site
class SiteMock
  attr_reader :config

  def initialize
    @config = YAML.safe_load(File.read('../demo/_config.yml'))
    @config['env'] = { 'JEKYLL_ENV' => 'development' }
  end

  def collections
    Collections.new
  end
end

class TestLiquidContext < Liquid::Context
  def initialize
    super

    page = {
      'content'     => 'blah blah',
      'description' => 'Jekyll plugin support demo',
      'dir'         => '/',
      'excerpt'     => nil,
      'layout'      => 'default',
      'name'        => 'index.html',
      'path'        => 'index.html',
      'title'       => 'Welcome',
      'url'         => '/',
    }

    @content = 'Interior of the tag'
    @registers = Registers.new(
      page,
      SiteMock.new
    )
  end
end

# Mock for Liquid::ParseContent
class TestParseContext < Liquid::ParseContext
  attr_reader :line_number, :registers

  def initialize
    super
    @line_number = 123

    @registers = Registers.new(
      { 'path' => 'path/to/page.html' },
      SiteMock.new
    )
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
nugem-0.8.1 templates/jekyll/common_scaffold/spec/spec_helper.rb
jekyll_emoji_tag-0.1.0 spec/spec_helper.rb
jekyll_eval_filter-0.1.1 spec/spec_helper.rb
jekyll_eval_filter-0.1.0 spec/spec_helper.rb