Sha256: 2d5ff92d6e7015379139080c582632af5b02ead876d3429e52a2cb9d6b045e7f

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

describe DeployGate::Deploy do
  describe "#push" do
    context "raise error" do
      it "NotLoginError" do
        allow_any_instance_of(DeployGate::Session).to receive(:login?) { false }

        expect {
          DeployGate::Deploy.push(test_file_path, 'test', 'message')
        }.to raise_error DeployGate::Deploy::NotLoginError
      end

      it "NotFileExistError" do
        expect {
          DeployGate::Deploy.push('no_file_path', 'test', 'message')
        }.to raise_error DeployGate::Deploy::NotFileExistError
      end

      it "UploadError" do
        allow_any_instance_of(DeployGate::Session).to receive(:login?) { true }
        allow(DeployGate::API::V1::Push).to receive(:upload).and_return({:error => true, :message => 'error message'})

        expect {
          DeployGate::Deploy.push(test_file_path, 'test', 'message')
        }.to raise_error DeployGate::Deploy::UploadError
      end
    end

    context "success" do
      it "default" do
        allow(DeployGate::API::V1::Push).to receive(:upload).and_return({:error => false})
        allow_any_instance_of(DeployGate::Session).to receive(:login?) { true }

        expect {
          DeployGate::Deploy.push(test_file_path, 'test', 'message')
        }.not_to raise_error
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
deploygate-0.0.5 spec/deploygate/deploy_spec.rb
deploygate-0.0.4 spec/deploygate/deploy_spec.rb
deploygate-0.0.3 spec/deploygate/deploy_spec.rb
deploygate-0.0.2 spec/deploygate/deploy_spec.rb
deploygate-0.0.1 spec/deploygate/deploy_spec.rb