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: 0b0196cc721fdc7229f867626afba6711cc20564
4
- data.tar.gz: aec839b296058294095c7b76f16c03c4dd4705ce
3
+ metadata.gz: 6ce6c4554e6c42965b4874d312840e50931e3f3e
4
+ data.tar.gz: 055fe718d06f63f709dfeb7ce359c614c81dcc97
5
5
  SHA512:
6
- metadata.gz: a1b240b6077c8cfdac98c4aa9738ab10ea6188f781755c7dc16bf33733e48c17b099a7bfe35d33e5365a0b0938884f8a122266b0693280c7f29377ee702de720
7
- data.tar.gz: 2c5385dcfb34796bd5345af2612d2bae152b617c249ce100497e0687561635b57b5ee2c7e66eff3778f35d5d8886ea6fde591377953a7f98d4fe7c438852e1e8
6
+ metadata.gz: 1c3c73f2cf1c45e62a44aca557b75cf14e4ec0eb16e3530a419014abef48e901d696a31fca6192f7a93b5ed6802673f0d744a47cf6781574c2634ed27f20fcc0
7
+ data.tar.gz: 99c9d15c68d1e302e02d728ffed4ca279dadc5c93fc3c07c25af1f240d5a20205b65809be20a0dcbd8d3f272c7b3d2a686be55929f166fcfb4385690489d857d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- penetration (0.0.4)
4
+ penetration (0.0.5)
5
5
  rails (~> 4.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module Penetration
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.first) rescue next
73
+ preset = Preset.find(element.last.shift) rescue next
74
74
  if preset.is_a?(Proc)
75
- element.last[1] ? preset.(element.last[1]) : preset.()
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) { 'peenetrated notification!' }
4
- preset(:too_long) { 'peenetrated notification!' * 500 }
5
- preset(:alert) { ->(message) { "peenetrated #{message}" } }
6
- preset(:no_param) { -> { "peenetrated noparam!" } }
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 'peenetrated penetration!'
14
+ penetrate 'penetrated penetration!'
14
15
  render :index
15
16
  end
16
17
 
17
18
  def dynamic_too_long
18
- penetrate 'peenetrated penetration!' * 500
19
+ penetrate 'penetrated penetration!' * 500
19
20
  render json: {}
20
21
  end
21
22
 
22
23
  def tag
23
- penetrate '<strong>peenetrated penetration!</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!'
@@ -7,5 +7,6 @@ Dummy::Application.routes.draw do
7
7
  get 'penetrations/preset_too_long'
8
8
  get 'penetrations/with_no_param'
9
9
  get 'penetrations/with_param'
10
+ get 'penetrations/with_multiple_params'
10
11
  get 'penetrations/double'
11
12
  end
@@ -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('peenetrated penetration!')
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('peenetrated penetration!')
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>peenetrated penetration!</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('peenetrated notification!')
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('peenetrated notification!' * 10)
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('peenetrated noparam!')
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('peenetrated alert!')
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('peenetrated alert1!')
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('peenetrated alert2!')
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.5
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-14 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails