secure 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,11 +29,20 @@ module Secure
29
29
  $stdin.reopen(@pipe_stdin) if @pipe_stdin
30
30
  end
31
31
 
32
+ def run_before_methods
33
+ return unless @run_before
34
+ if @run_before.is_a? Array
35
+ @run_before.each &:call
36
+ else
37
+ @run_before.call
38
+ end
39
+ end
40
+
32
41
  def safely_run_block
33
42
  set_resource_limits
34
43
  redirect_files
35
44
  thread = Thread.start do
36
- @run_before.call if @run_before
45
+ run_before_methods
37
46
  $SAFE=3
38
47
  yield
39
48
  end
@@ -1,3 +1,3 @@
1
1
  module Secure
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -33,6 +33,16 @@ module Secure
33
33
  response.value.should == 0
34
34
  end
35
35
 
36
+ it "accepts multiple blocks that are run before safeing" do
37
+ before_1 = lambda { $FOO = 1 }
38
+ before_2 = lambda { $BAR = 2 }
39
+ response = Runner.new(:run_before => [before_1, before_2] ).run do
40
+ $FOO + $BAR
41
+ end
42
+ response.should be_success
43
+ response.value.should == 3
44
+ end
45
+
36
46
  context "safe value" do
37
47
  it "should be set to 3" do
38
48
  response = Runner.new.run do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70187516791060 !ruby/object:Gem::Requirement
16
+ requirement: &70252604126500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.6'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70187516791060
24
+ version_requirements: *70252604126500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70187516790620 !ruby/object:Gem::Requirement
27
+ requirement: &70252604125960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70187516790620
35
+ version_requirements: *70252604125960
36
36
  description: see summary
37
37
  email:
38
38
  - tejas@gja.in