Sha256: 184c7b2813b2211ee48046a7015de7b96fc73f9bb668fd9c3089d880791aaebc

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require 'tempfile'
require 'spec_helper'

describe "redpomo init" do

  let(:config_path) {
    new_config = Tempfile.new('redpomo')
    new_config_path = new_config.path
    new_config.unlink
    new_config_path
  }

  it "generates a .redpomo config file" do
    redpomo "init #{config_path}", env: { "EDITOR" => "echo editor" }
    File.exists?(config_path).should 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 == "To open the .redpomo config file, set $EDITOR or $REDPOMO_EDITOR"
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redpomo-0.0.9 spec/integration/init_spec.rb
redpomo-0.0.8 spec/integration/init_spec.rb
redpomo-0.0.7 spec/integration/init_spec.rb
redpomo-0.0.6 spec/integration/init_spec.rb