Sha256: 5a95f4efc230afbdb6494a1498398673103b4a1831910cecb9ff779ae72d1581

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

require "spec_helper"

describe "User Error" do
  isolate :conveyors, :router, before: :all

  before(:all) do
    rad.delete :conveyors
    rad.conveyors.web do |web|
      web.use Rad::Controller::Processors::ControllerCaller
    end
  end

  after :all do
    remove_constants %w(UserErrorSpec)
  end

  it "user error" do
    class ::UserErrorSpec
      inherit Rad::Controller::Http

      def action
        raise_user_error "some error"
      end

      protected
        def catch_user_error
          begin
            yield
          rescue UserError => ue
            render inline: "Catched #{ue.message}"
          end
        end
        around :catch_user_error
    end

    ccall(UserErrorSpec, :action).should == "Catched some error"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rad_kit-0.0.10 spec/misc/user_error_spec.rb
rad_kit-0.0.9 spec/misc/user_error_spec.rb