Sha256: 969468dd2b474e26cfd0b9a561f8e09fe1a3d671d5abca55b6557571c4fd7f94

Contents?: true

Size: 1.42 KB

Versions: 5

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(/drafts?/)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jekyll-auth-2.0.0 spec/jekyll_auth_spec.rb
jekyll-auth-1.0.3 spec/jekyll_auth_spec.rb
jekyll-auth-1.0.2 spec/jekyll_auth_spec.rb
jekyll-auth-1.0.1 spec/jekyll_auth_spec.rb
jekyll-auth-1.0.0 spec/jekyll_auth_spec.rb