Sha256: ef76fd9f327e924fcfba2c8f6b0ec76cea183df7e234ef38e47d393e12025454

Contents?: true

Size: 968 Bytes

Versions: 11

Compression:

Stored size: 968 Bytes

Contents

require "spec_helper"

describe ::ActiveRemote::RemoteRecordNotSaved do
  let(:record) { ::Tag.new }

  before do
    record.errors[:base] << "Some error one!"
    record.errors[:base] << "Some error two!"
  end

  context "when an active remote record is used" do
    it "uses embedded errors in message" do
      expect { fail(::ActiveRemote::RemoteRecordNotSaved, record) }
        .to raise_error(ActiveRemote::RemoteRecordNotSaved, "Some error one!, Some error two!")
    end
  end

  context "when a string is used" do
    it "uses the string in the error message" do
      expect { fail(::ActiveRemote::RemoteRecordNotSaved, "something bad happened") }
        .to raise_error(ActiveRemote::RemoteRecordNotSaved, "something bad happened")
    end
  end

  context "when no message is used" do
    it "raises the error" do
      expect { raise(::ActiveRemote::RemoteRecordNotSaved) }
        .to raise_error(ActiveRemote::RemoteRecordNotSaved)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active_remote-6.0.3 spec/lib/active_remote/errors_spec.rb
active_remote-6.0.2 spec/lib/active_remote/errors_spec.rb
active_remote-6.0.1 spec/lib/active_remote/errors_spec.rb
active_remote-6.0.0.beta spec/lib/active_remote/errors_spec.rb
active_remote-5.2.0 spec/lib/active_remote/errors_spec.rb
active_remote-5.2.0.beta spec/lib/active_remote/errors_spec.rb
active_remote-3.3.3 spec/lib/active_remote/errors_spec.rb
active_remote-5.2.0.alpha spec/lib/active_remote/errors_spec.rb
active_remote-3.3.2 spec/lib/active_remote/errors_spec.rb
active_remote-5.0.1 spec/lib/active_remote/errors_spec.rb
active_remote-5.1.1 spec/lib/active_remote/errors_spec.rb