Sha256: eb33f3436173d9cad9373e71644b82d1c217622a1494d016668f1bc9818bd932

Contents?: true

Size: 899 Bytes

Versions: 9

Compression:

Stored size: 899 Bytes

Contents

require "spec_helper"

describe "deploys" do
  let(:app) { Octodmin::App.new(File.expand_path("../..", __dir__)) }

  before do
    expect(Octopress::Deploy).to receive(:push).once
  end

  describe "create" do
    context "invalid" do
      before do
        allow(Octopress::Deploy).to receive(:push).and_raise(SystemExit, "Deploy error")
        post "/api/deploys"
      end
      subject { parse_json(last_response.body)["errors"] }

      it "returns errors" do
        expect(last_response).to_not be_ok
        expect(subject).to eql(["Deploy error"])
      end
    end

    context "valid" do
      before do
        allow(Octopress::Deploy).to receive(:push).and_return(nil)
        post "/api/deploys"
      end
      subject { parse_json(last_response.body)["deploys"] }

      it "returns errors" do
        expect(subject).to eql(["Deployed successfully"])
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
octodmin-0.3.5 spec/api/deploys_spec.rb
octodmin-0.3.4 spec/api/deploys_spec.rb
octodmin-0.3.3 spec/api/deploys_spec.rb
octodmin-0.3.2 spec/api/deploys_spec.rb
octodmin-0.3.1 spec/api/deploys_spec.rb
octodmin-0.3.0 spec/api/deploys_spec.rb
octodmin-0.2.1 spec/api/deploys_spec.rb
octodmin-0.2.0 spec/api/deploys_spec.rb
octodmin-0.1.0 spec/api/deploys_spec.rb