penetration 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce6c4554e6c42965b4874d312840e50931e3f3e
|
4
|
+
data.tar.gz: 055fe718d06f63f709dfeb7ce359c614c81dcc97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c3c73f2cf1c45e62a44aca557b75cf14e4ec0eb16e3530a419014abef48e901d696a31fca6192f7a93b5ed6802673f0d744a47cf6781574c2634ed27f20fcc0
|
7
|
+
data.tar.gz: 99c9d15c68d1e302e02d728ffed4ca279dadc5c93fc3c07c25af1f240d5a20205b65809be20a0dcbd8d3f272c7b3d2a686be55929f166fcfb4385690489d857d
|
data/Gemfile.lock
CHANGED
data/lib/penetration/version.rb
CHANGED
data/lib/penetration.rb
CHANGED
@@ -70,9 +70,9 @@ module Penetration
|
|
70
70
|
when :raw
|
71
71
|
element.last
|
72
72
|
when :preset
|
73
|
-
preset = Preset.find(element.last.
|
73
|
+
preset = Preset.find(element.last.shift) rescue next
|
74
74
|
if preset.is_a?(Proc)
|
75
|
-
element.last
|
75
|
+
element.last.present? ? preset.(*element.last) : preset.()
|
76
76
|
else
|
77
77
|
preset
|
78
78
|
end
|
@@ -1,26 +1,27 @@
|
|
1
1
|
class PenetrationsController < ApplicationController
|
2
2
|
Penetration.configure do
|
3
|
-
preset(:notify) { '
|
4
|
-
preset(:too_long) { '
|
5
|
-
preset(:alert) { ->(message) { "
|
6
|
-
preset(:no_param) { -> { "
|
3
|
+
preset(:notify) { 'penetrated notification!' }
|
4
|
+
preset(:too_long) { 'penetrated notification!' * 500 }
|
5
|
+
preset(:alert) { ->(message) { "penetrated #{message}" } }
|
6
|
+
preset(:no_param) { -> { "penetrated noparam!" } }
|
7
|
+
preset(:multiple) { ->(a, b) { "penetrated #{a} #{b}" } }
|
7
8
|
end
|
8
9
|
|
9
10
|
def index
|
10
11
|
end
|
11
12
|
|
12
13
|
def dynamic
|
13
|
-
penetrate '
|
14
|
+
penetrate 'penetrated penetration!'
|
14
15
|
render :index
|
15
16
|
end
|
16
17
|
|
17
18
|
def dynamic_too_long
|
18
|
-
penetrate '
|
19
|
+
penetrate 'penetrated penetration!' * 500
|
19
20
|
render json: {}
|
20
21
|
end
|
21
22
|
|
22
23
|
def tag
|
23
|
-
penetrate '<strong>
|
24
|
+
penetrate '<strong>penetrated penetration!</strong>'
|
24
25
|
render :index
|
25
26
|
end
|
26
27
|
|
@@ -31,7 +32,6 @@ class PenetrationsController < ApplicationController
|
|
31
32
|
render :index
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
35
|
def preset_too_long
|
36
36
|
penetrate {
|
37
37
|
too_long
|
@@ -53,6 +53,13 @@ class PenetrationsController < ApplicationController
|
|
53
53
|
render :index
|
54
54
|
end
|
55
55
|
|
56
|
+
def with_multiple_params
|
57
|
+
penetrate {
|
58
|
+
multiple 'alert!', 'alert!!'
|
59
|
+
}
|
60
|
+
render :index
|
61
|
+
end
|
62
|
+
|
56
63
|
def double
|
57
64
|
penetrate {
|
58
65
|
alert 'alert1!'
|
data/spec/dummy/config/routes.rb
CHANGED
@@ -7,12 +7,12 @@ describe 'Penetrations', type: :request do
|
|
7
7
|
|
8
8
|
it do
|
9
9
|
get '/penetrations/index'
|
10
|
-
expect(response.body).not_to include('
|
10
|
+
expect(response.body).not_to include('penetrated penetration!')
|
11
11
|
end
|
12
12
|
|
13
13
|
it do
|
14
14
|
get '/penetrations/dynamic'
|
15
|
-
expect(response.body).to include('
|
15
|
+
expect(response.body).to include('penetrated penetration!')
|
16
16
|
end
|
17
17
|
|
18
18
|
it do
|
@@ -23,37 +23,42 @@ describe 'Penetrations', type: :request do
|
|
23
23
|
|
24
24
|
it do
|
25
25
|
get '/penetrations/tag'
|
26
|
-
expect(response.body).to include('<strong>
|
26
|
+
expect(response.body).to include('<strong>penetrated penetration!</strong>')
|
27
27
|
end
|
28
28
|
|
29
29
|
it do
|
30
30
|
get '/penetrations/preset'
|
31
|
-
expect(response.body).to include('
|
31
|
+
expect(response.body).to include('penetrated notification!')
|
32
32
|
end
|
33
33
|
|
34
34
|
it do
|
35
35
|
get '/penetrations/preset_too_long'
|
36
36
|
get '/penetrations/index'
|
37
|
-
expect(response.body).to include('
|
37
|
+
expect(response.body).to include('penetrated notification!' * 10)
|
38
38
|
end
|
39
39
|
|
40
40
|
it do
|
41
41
|
get '/penetrations/with_no_param'
|
42
|
-
expect(response.body).to include('
|
42
|
+
expect(response.body).to include('penetrated noparam!')
|
43
43
|
end
|
44
44
|
|
45
45
|
it do
|
46
46
|
get '/penetrations/with_param'
|
47
|
-
expect(response.body).to include('
|
47
|
+
expect(response.body).to include('penetrated alert!')
|
48
|
+
end
|
49
|
+
|
50
|
+
it do
|
51
|
+
get '/penetrations/with_multiple_params'
|
52
|
+
expect(response.body).to include('penetrated alert! alert!!')
|
48
53
|
end
|
49
54
|
|
50
55
|
it do
|
51
56
|
get '/penetrations/double'
|
52
|
-
expect(response.body).to include('
|
57
|
+
expect(response.body).to include('penetrated alert1!')
|
53
58
|
end
|
54
59
|
|
55
60
|
it do
|
56
61
|
get '/penetrations/double'
|
57
|
-
expect(response.body).to include('
|
62
|
+
expect(response.body).to include('penetrated alert2!')
|
58
63
|
end
|
59
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: penetration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mmmpa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|