flail 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/flail/exception.rb +1 -1
- data/lib/flail/version.rb +1 -1
- data/spec/rescue_action_spec.rb +8 -0
- data/spec/spec_helper.rb +10 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/flail/exception.rb
CHANGED
@@ -43,7 +43,7 @@ class Flail
|
|
43
43
|
info = {}
|
44
44
|
|
45
45
|
# rack env
|
46
|
-
info[:rack] = @env.
|
46
|
+
info[:rack] = @env.except('flail.request', 'flail.request.data')
|
47
47
|
info[:class_name] = @exception.class.to_s # @exception class
|
48
48
|
info[:message] = @exception.to_s # error message
|
49
49
|
info[:trace] = @exception.backtrace # backtrace of error
|
data/lib/flail/version.rb
CHANGED
data/spec/rescue_action_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
require 'ostruct'
|
3
4
|
require 'flail/rails/rescue_action'
|
4
5
|
|
5
6
|
describe Flail::Rails::RescueAction do
|
@@ -41,5 +42,12 @@ describe Flail::Rails::RescueAction do
|
|
41
42
|
|
42
43
|
FlailArmory.payload['session_data'].should == data
|
43
44
|
end
|
45
|
+
|
46
|
+
it "should send user data" do
|
47
|
+
user = OpenStruct.new(:attributes => {:id => 1, :login => 'jlong'})
|
48
|
+
FlailArmory.process_action_with_error(:user => user)
|
49
|
+
|
50
|
+
FlailArmory.payload['user'].should == {'id' => 1, 'login' => 'jlong'}
|
51
|
+
end
|
44
52
|
end
|
45
53
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -51,6 +51,10 @@ class FlailArmory
|
|
51
51
|
cattr_accessor :local
|
52
52
|
define_method(:index, &action)
|
53
53
|
|
54
|
+
def current_user
|
55
|
+
@current_user
|
56
|
+
end
|
57
|
+
|
54
58
|
def local_request?
|
55
59
|
local
|
56
60
|
end
|
@@ -68,10 +72,15 @@ class FlailArmory
|
|
68
72
|
klass.local = options[:local]
|
69
73
|
|
70
74
|
controller = klass.new
|
75
|
+
|
76
|
+
if options[:user]
|
77
|
+
controller.instance_variable_set(:@current_user, options[:user])
|
78
|
+
end
|
79
|
+
|
71
80
|
options[:request].query_parameters = options[:request].query_parameters.merge(options[:params] || {})
|
72
81
|
options[:request].session = ActionController::TestSession.new(options[:session] || {})
|
73
|
-
|
74
82
|
options[:request].env['REQUEST_URI'] = options[:request].request_uri
|
83
|
+
|
75
84
|
controller.process(options[:request], options[:response])
|
76
85
|
controller
|
77
86
|
end
|