Sha256: 3533636a5fd338f751f4070c99a60067a0d020b5956d694da5858430ba6847f2

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

require "helper"

describe VimGolf do
  it "provides VimGolf errors" do
    VimGolf::Error.should be
  end

  it "sets up VimGolf.ui" do
    VimGolf.ui.should be_an(VimGolf::UI)
    capture_stdout do
      VimGolf::CLI.start(["help"])
    end
    VimGolf.ui.should be_an(VimGolf::CLI::UI)
  end

  it "provides a help prompt" do
    out = capture_stdout do
      VimGolf::CLI.start(["help"])
    end

    out.should include("setup")
    out.should include("launch")
  end

  describe "download / upload challenge" do
    let(:c) { VimGolf::CLI.new }

    it "should raise error on invalid challenge" do
      lambda { c.download('invalidID') }.should raise_error
    end

    it "should return type of challenge on success" do
      c.download('4d1a1c36567bac34a9000002').should == "rb"
    end

    it "should raise error on invalid upload id" do
      lambda { c.upload('invalidID') }.should raise_error
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vimgolf-0.3.0 spec/cli_spec.rb
vimgolf-0.2.0 spec/cli_spec.rb
vimgolf-0.1.1 spec/cli_spec.rb