lunetas 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/lunetas/candy.rb +11 -1
- data/spec/lunetas/candy_spec.rb +5 -0
- data/spec/spec_helper.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/lunetas/candy.rb
CHANGED
@@ -55,7 +55,13 @@ module Lunetas::Candy
|
|
55
55
|
before
|
56
56
|
response(handle_call)
|
57
57
|
rescue Exception => e
|
58
|
-
|
58
|
+
code, error = 500, e
|
59
|
+
if Lunetas::Error::BaseError === e
|
60
|
+
code = e.code
|
61
|
+
elsif development?
|
62
|
+
error = "Error: #{e.message}\nBacktrace: #{e.backtrace.join('\n')}"
|
63
|
+
end
|
64
|
+
response(error, code)
|
59
65
|
end
|
60
66
|
|
61
67
|
private
|
@@ -98,6 +104,10 @@ module Lunetas::Candy
|
|
98
104
|
@req.session
|
99
105
|
end
|
100
106
|
|
107
|
+
def development?
|
108
|
+
ENV['RAILS_ENV'] == 'development' || ENV['RACK_ENV'].nil? || ENV['RACK_ENV'] == 'development'
|
109
|
+
end
|
110
|
+
|
101
111
|
# TODO: Polish this
|
102
112
|
# def authenticate!
|
103
113
|
# @current_user = User.where(:single_access_token => token).first
|
data/spec/lunetas/candy_spec.rb
CHANGED
@@ -50,6 +50,11 @@ describe Lunetas::Candy::InstanceMethods do
|
|
50
50
|
@instance.bite
|
51
51
|
end
|
52
52
|
|
53
|
+
it 'should answer with a 500 if raised a runtime error' do
|
54
|
+
@instance.should_receive(:before).and_raise(StandardError)
|
55
|
+
@instance.bite.first.should == 500
|
56
|
+
end
|
57
|
+
|
53
58
|
it 'should call to the get method' do
|
54
59
|
@instance.should_receive(:get)
|
55
60
|
@instance.bite
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lunetas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Iv\xC3\xA1n Vald\xC3\xA9s (@ivanvc)"
|