Class: RenamerMock
Instance Attribute Summary collapse
-
#renames ⇒ Object
readonly
Returns the value of attribute renames.
Attributes included from Options
Instance Method Summary collapse
- #actual_delete(fn) ⇒ Object
- #actual_delete_orig ⇒ Object
- #actual_rename(o, n) ⇒ Object
- #actual_rename_orig ⇒ Object
- #rename(path, oldfn, newfn, full_path = false) ⇒ Object
- #run(name, options, &block) ⇒ Object
Methods inherited from Renamer
Methods included from Options
Instance Attribute Details
#renames ⇒ Object (readonly)
Returns the value of attribute renames.
13 14 15 |
# File 'lib/test/test_helper.rb', line 13 def renames @renames end |
Instance Method Details
#actual_delete(fn) ⇒ Object
61 62 63 |
# File 'lib/test/test_helper.rb', line 61 def actual_delete(fn) @renames << [fn, :deleted] end |
#actual_delete_orig ⇒ Object
59 |
# File 'lib/test/test_helper.rb', line 59 alias actual_delete_orig actual_delete |
#actual_rename(o, n) ⇒ Object
55 56 57 |
# File 'lib/test/test_helper.rb', line 55 def actual_rename(o, n) @renames << [o, n] end |
#actual_rename_orig ⇒ Object
53 |
# File 'lib/test/test_helper.rb', line 53 alias actual_rename_orig actual_rename |
#rename(path, oldfn, newfn, full_path = false) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/test/test_helper.rb', line 37 def rename(path, oldfn, newfn, full_path = false) super if @onrename r = @onrename.call(:path => path, :oldfn => oldfn, :newfn => newfn, :full_path => full_path, :result => @result, :result_type => @result_type, :result_path => @result_path, :result_file => @result_file, :confirm => @confirm) @yielded = true end end |
#run(name, options, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/test/test_helper.rb', line 15 def run(name, , &block) @onrename = block @renames = [] @yielded = true p = [:file_provider] if p.methods.include? "on_after" p.on_after do unless @onrename and @yielded @onrename.call :result => @result, :result_type => @result_type, :result_path => @result_path, :result_file => @result_file @yielded = true end end end super(name, ) do |rtype, result, path, file| @result = result @result_type = rtype @result_path = path @result_file = file @yielded = false end end |