File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,11 @@ def print(*items)
131
131
nil
132
132
end
133
133
134
+ # Returns the size of the file from stats
135
+ def size
136
+ stat . size
137
+ end
138
+
134
139
# Writes each argument to the stream, appending a newline to any item
135
140
# that does not already end in a newline. Array arguments are flattened.
136
141
def puts ( *items )
Original file line number Diff line number Diff line change @@ -156,4 +156,10 @@ def test_stat_should_return_attributes_object_for_handle
156
156
@sftp . expects ( :fstat! ) . with ( "handle" ) . returns ( stat )
157
157
assert_equal stat , @file . stat
158
158
end
159
- end
159
+
160
+ def test_size_should_return_size_from_stat
161
+ stat = stub ( size : 1024 )
162
+ @sftp . expects ( :fstat! ) . with ( "handle" ) . returns ( stat )
163
+ assert_equal 1024 , @file . size
164
+ end
165
+ end
You can’t perform that action at this time.
0 commit comments