Sha256: 465e5953122a76d1eb534e2d12285724d37308bb991fa03aebccade239b57ec2

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

require "spec_helper"

describe "bin" do
  before(:each) do
    setup_tmp_dir
  end

  it "spits out the help do" do
    env = { "GITHUB_TOKEN" => nil}
    output = execute_bin(env, "--help")
    expect(output).to match(%r{A simple way to use Github OAuth to serve a protected jekyll site to your GitHub organization})
  end

  describe "team id" do

    it "errors if no token is given" do
      env = { "GITHUB_TOKEN" => nil}
      expect{execute_bin(env, "team_id", "--org", "balter-test-org", "--team", "1")}.to raise_error(RuntimeError).
      with_message(/prefix the jekyll-auth command with GITHUB_TOKEN/)
    end

    it "errors if no team_id or org_id is given" do
      env = { "GITHUB_TOKEN" => "1234"}
      expect{execute_bin(env, "team_id")}.to raise_error(RuntimeError).
      with_message(/An org name and team ID are required/)
    end
  end

  it "initializes a new site" do
    `git init`
    `git add .`
    `git commit -m 'initial commit'`
    execute_bin({"RACK_ENV" => "TEST"}, "new")
    expect(File).to exist("#{tmp_dir}/config.ru")
    expect(File).to exist("#{tmp_dir}/Rakefile")
    expect(File).to exist("#{tmp_dir}/.gitignore")
    expect(File).to exist("#{tmp_dir}/.env")
  end

  it "builds the site" do
    execute_bin({}, "build")
    expect(File).to exist("#{tmp_dir}/_site/index.html")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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