Sha256: a11a9162f2d6cb54649d8d26e66f129191374848bd381d1c293c68bc83bc6335

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Fear::TryApi do
  describe "Fear.try" do
    context "when success" do
      subject { Fear.try { 42 } }

      it { is_expected.to be_success_of(42) }
    end

    context "when failure" do
      subject { Fear.try { raise RuntimeError } }

      it { is_expected.to be_failure_of(RuntimeError) }
    end

    context "when low level error happened" do
      subject(:try) { Fear.try { raise Exception } }

      it { expect { try }.to raise_error(Exception) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fear-3.0.0 spec/fear/try_api_spec.rb
fear-2.0.1 spec/fear/try_api_spec.rb
fear-2.0.0 spec/fear/try_api_spec.rb