Sha256: 65f7d5116cdb5e538947adf693b179ac224eafec0c700a90e2864e87eaa844a2

Contents?: true

Size: 1.31 KB

Versions: 24

Compression:

Stored size: 1.31 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('push', test_file_path, 'test', 'message', nil)
        }.to raise_error DeployGate::Deploy::NotLoginError
      end

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
deploygate-0.9.1 spec/deploygate/deploy_spec.rb
deploygate-0.9.0 spec/deploygate/deploy_spec.rb
deploygate-0.8.6 spec/deploygate/deploy_spec.rb
deploygate-0.8.5 spec/deploygate/deploy_spec.rb
deploygate-0.8.4 spec/deploygate/deploy_spec.rb
deploygate-0.8.3 spec/deploygate/deploy_spec.rb
deploygate-0.8.2 spec/deploygate/deploy_spec.rb
deploygate-0.8.1 spec/deploygate/deploy_spec.rb
deploygate-0.8.0 spec/deploygate/deploy_spec.rb
deploygate-0.7.0 spec/deploygate/deploy_spec.rb
deploygate-0.6.8 spec/deploygate/deploy_spec.rb
deploygate-0.6.7 spec/deploygate/deploy_spec.rb
deploygate-0.6.6 spec/deploygate/deploy_spec.rb
deploygate-0.6.5 spec/deploygate/deploy_spec.rb
deploygate-0.6.4 spec/deploygate/deploy_spec.rb
deploygate-0.6.3 spec/deploygate/deploy_spec.rb
deploygate-0.6.2 spec/deploygate/deploy_spec.rb
deploygate-0.6.1 spec/deploygate/deploy_spec.rb
deploygate-0.6.0 spec/deploygate/deploy_spec.rb
deploygate-0.5.6 spec/deploygate/deploy_spec.rb