@@ -41,34 +41,24 @@ class PaperclipTest < Test::Unit::TestCase
41
41
end
42
42
43
43
context "Calling Paperclip.run and logging" do
44
- setup do
44
+ should "log the command when :log_command is true" do
45
45
Paperclip . options [ :image_magick_path ] = nil
46
46
Paperclip . options [ :command_path ] = nil
47
47
Paperclip . stubs ( :bit_bucket ) . returns ( "/dev/null" )
48
- Paperclip . stubs ( :log )
49
- Paperclip . stubs ( :"`" ) . with ( "this is the command 2>/dev/null" )
50
- end
51
-
52
- should "log the command when :log_command is true" do
48
+ Paperclip . expects ( :log ) . with ( "this is the command 2>/dev/null" )
49
+ Paperclip . expects ( :"`" ) . with ( "this is the command 2>/dev/null" )
53
50
Paperclip . options [ :log_command ] = true
54
51
Paperclip . run ( "this" , "is the command" )
55
- assert_received ( Paperclip , :log ) do |p |
56
- p . with ( "this is the command 2>/dev/null" )
57
- end
58
- assert_received ( Paperclip , :` ) do |p |
59
- p . with ( "this is the command 2>/dev/null" )
60
- end
61
52
end
62
53
63
54
should "not log the command when :log_command is false" do
55
+ Paperclip . options [ :image_magick_path ] = nil
56
+ Paperclip . options [ :command_path ] = nil
57
+ Paperclip . stubs ( :bit_bucket ) . returns ( "/dev/null" )
58
+ Paperclip . expects ( :log ) . with ( "this is the command 2>/dev/null" ) . never
59
+ Paperclip . expects ( :"`" ) . with ( "this is the command 2>/dev/null" )
64
60
Paperclip . options [ :log_command ] = false
65
61
Paperclip . run ( "this" , "is the command" )
66
- assert_received ( Paperclip , :log ) do |p |
67
- p . with ( "this is the command 2>/dev/null" ) . never
68
- end
69
- assert_received ( Paperclip , :` ) do |p |
70
- p . with ( "this is the command 2>/dev/null" )
71
- end
72
62
end
73
63
end
74
64
0 commit comments