Sha256: c313c724df7206a838482dd67200f325323a57e4d7795f81d9770defcf44cc2e

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require "spec_helper"

describe "JekyllAuth" do
  before(:each) do
    setup_tmp_dir
    JekyllAuth.instance_variable_set("@config", nil)
  end

  it "should know the config file path" do
    expected = File.expand_path "tmp/_config.yml", base_dir
    expect(JekyllAuth.config_file).to eql(expected)
  end

  it "should return a null hash if no config file exists" do
    expect(JekyllAuth.config).to eql({})
  end

  it "should return a null hash if config file doesn't contain jekyll_auth" do
    File.write(JekyllAuth.config_file, "foo: bar\n")
    expect(JekyllAuth.config).to eql({})
  end

  it "should return the config hash if the config files contains jekyll_auth" do
    File.write(JekyllAuth.config_file, "jekyll_auth:\n  ssl: true\n  whitelist:\n   - drafts?\n")
    expect(JekyllAuth.config).to eql("ssl" => true, "whitelist" => ["drafts?"])
  end

  it "should disable ssl by default" do
    expect(JekyllAuth.ssl?).to eql(false)
  end

  it "should know when ssl is requested" do
    File.write(JekyllAuth.config_file, "jekyll_auth:\n  ssl:true\n")
    expect(JekyllAuth.ssl?).to eql(true)
  end

  it "should know when ssl is disabled" do
    File.write(JekyllAuth.config_file, "jekyll_auth:\n  ssl:false\n")
    expect(JekyllAuth.ssl?).to eql(true)
  end

  it "should parse the whitelist" do
    File.write(JekyllAuth.config_file, "jekyll_auth:\n  whitelist:\n   - drafts?\n")
    expect(JekyllAuth.whitelist).to eql(%r!drafts?!)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-auth-2.1.0 spec/jekyll_auth_spec.rb