Sha256: 2cea35b6744fd59efa4934175f22343497ae54d50ef9ccd76083edef248fa419

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'tempfile'
require 'spec_helper'

describe "redpomo init" do

  let(:config_path) { tmp_path('redpomo') }

  it "generates a .redpomo config file" do
    redpomo "init #{config_path}", env: { "EDITOR" => "echo editor" }
    expect(File.exists?(config_path)).to be true
  end

  it "opens the config with REDPOMO_EDITOR as highest priority" do
    redpomo "init #{config_path}", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "REDPOMO_EDITOR" => "echo redpomo_editor"}
    out.should == "redpomo_editor #{config_path}"
  end

  it "opens the config with VISUAL as 2nd highest priority" do
    redpomo "init #{config_path}", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "REDPOMO_EDITOR" => ""}
    out.should == "visual #{config_path}"
  end

  it "opens the config with EDITOR as 3rd highest priority" do
    redpomo "init #{config_path}", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "REDPOMO_EDITOR" => ""}
    out.should == "editor #{config_path}"
  end

  it "complains if no EDITOR is set" do
    redpomo "init #{config_path}", :env => {"EDITOR" => "", "VISUAL" => "", "REDPOMO_EDITOR" => ""}
    out.should include "set $EDITOR or $REDPOMO_EDITOR"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redpomo-reloaded-0.0.14 spec/integration/init_spec.rb
redpomo-reloaded-0.0.13 ./spec/integration/init_spec.rb