Sha256: 490209d99d65be6c43c05ff81ef26d57430ef4e8523ac0ba60939139e18828b5

Contents?: true

Size: 1017 Bytes

Versions: 6

Compression:

Stored size: 1017 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe GithubCLI::Commands::Trees do
  let(:format) { 'table' }
  let(:user)   { 'peter-murach' }
  let(:repo)   { 'github_cli' }
  let(:sha)    { '3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15' }
  let(:api_class) { GithubCLI::Tree }

  it "invokes tree:get" do
    api_class.should_receive(:get).with(user, repo, sha, {}, format)
    subject.invoke "tree:get", [user, repo, sha]
  end

  it "invokes tree:get" do
    api_class.should_receive(:get).with(user, repo, sha, {'recursive' => true}, format)
    subject.invoke "tree:get", [user, repo, sha], :recursive => true
  end

  it "invokes tree:create" do
    api_class.should_receive(:create).with(user, repo, {}, format)
    subject.invoke "tree:create", [user, repo]
  end

  it "invokes tree:create --tree" do
    tree = { "path" => "file.rb", "mode" => "100644"}
    api_class.should_receive(:create).with(user, repo, {'tree' => [tree]}, format)
    subject.invoke "tree:create", [user, repo], :tree => [tree]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
github_cli-0.5.9 spec/github_cli/commands/trees_spec.rb
github_cli-0.5.8 spec/github_cli/commands/trees_spec.rb
github_cli-0.5.7 spec/github_cli/commands/trees_spec.rb
github_cli-0.5.6 spec/github_cli/commands/trees_spec.rb
github_cli-0.5.5 spec/github_cli/commands/trees_spec.rb
github_cli-0.5.4 spec/github_cli/commands/trees_spec.rb