Sha256: 23c462135cb1ca1ff6eb47cacd27547860d21c443d10dc4d239c91cffd78aeaa

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 Bytes

Contents

require "spec_helper_with_rad"

describe "User Error" do
  rad.web
  rad.reset :conveyors
  
  isolate :conveyors, before: :all
  
  before(:all){load 'spec_helper/web_profile.rb'}
  
  after :all do
    remove_constants %w(UserErrorSpec)
  end
  
  it "user error" do
    class ::UserErrorSpec
      inherit Rad::Controller::Http
      
      def call
        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, :call).should == "Catched some error"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rad_ext-0.0.6 spec/extensions/user_error_spec.rb
rad_ext-0.0.5 spec/extensions/user_error_spec.rb
rad_ext-0.0.4 spec/extensions/user_error_spec.rb
rad_ext-0.0.3 spec/extensions/user_error_spec.rb
rad_ext-0.0.2 spec/extensions/user_error_spec.rb
rad_ext-0.0.1 spec/extensions/user_error_spec.rb