Sha256: 6c393f1e3df8907bf13ced98a5345179fae464243af74310601beab3cc5f8afe

Contents?: true

Size: 1.28 KB

Versions: 16

Compression:

Stored size: 1.28 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', nil)
        }.to raise_error DeployGate::Deploy::NotLoginError
      end

      it "NotFileExistError" do
        expect {
          DeployGate::Deploy.push('no_file_path', 'test', 'message', nil)
        }.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', nil)
        }.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', nil)
        }.not_to raise_error
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
deploygate-0.5.1 spec/deploygate/deploy_spec.rb
deploygate-0.5.0 spec/deploygate/deploy_spec.rb
deploygate-0.4.1 spec/deploygate/deploy_spec.rb
deploygate-0.4.0 spec/deploygate/deploy_spec.rb
deploygate-0.3.3 spec/deploygate/deploy_spec.rb
deploygate-0.3.2 spec/deploygate/deploy_spec.rb
deploygate-0.3.1 spec/deploygate/deploy_spec.rb
deploygate-0.3.0 spec/deploygate/deploy_spec.rb
deploygate-0.2.3 spec/deploygate/deploy_spec.rb
deploygate-0.2.2 spec/deploygate/deploy_spec.rb
deploygate-0.2.1 spec/deploygate/deploy_spec.rb
deploygate-0.2.0 spec/deploygate/deploy_spec.rb
deploygate-0.1.2 spec/deploygate/deploy_spec.rb
deploygate-0.1.1 spec/deploygate/deploy_spec.rb
deploygate-0.1.0 spec/deploygate/deploy_spec.rb
deploygate-0.0.6 spec/deploygate/deploy_spec.rb