@@ -168,6 +168,50 @@ def test_push_non_forward_forced_raise_no_error
168
168
169
169
assert_equal "8496071c1b46c854b31185ea97743be6a8774479" , @remote_repo . ref ( "refs/heads/master" ) . target_id
170
170
end
171
+
172
+ end
173
+
174
+ class RemotePruneTest < Rugged ::TestCase
175
+ def setup
176
+ @remote_repo = FixtureRepo . from_libgit2 ( "testrepo.git" )
177
+ # We can only push to bare repos
178
+ @remote_repo . config [ 'core.bare' ] = 'true'
179
+
180
+ @repo = FixtureRepo . clone ( @remote_repo )
181
+ @repo . references . create ( "refs/heads/unit_test" , "8496071c1b46c854b31185ea97743be6a8774479" )
182
+
183
+ @remote = @repo . remotes [ 'origin' ]
184
+
185
+ @remote . push ( [ "refs/heads/unit_test" ] )
186
+ @remote_repo . references . delete ( "refs/heads/unit_test" )
187
+ end
188
+
189
+ def test_fetch_prune_is_forced
190
+ assert_equal "8496071c1b46c854b31185ea97743be6a8774479" , @repo . ref ( "refs/remotes/origin/unit_test" ) . target_id
191
+ @remote . fetch ( prune : true )
192
+ assert_nil @repo . ref ( "refs/remotes/origin/unit_test" )
193
+ end
194
+
195
+ def test_fetch_prune_is_not_forced
196
+ @remote . fetch ( prune : false )
197
+ assert_equal "8496071c1b46c854b31185ea97743be6a8774479" , @repo . ref ( "refs/remotes/origin/unit_test" ) . target_id
198
+ end
199
+
200
+ def test_fetch_prune_nil
201
+ @remote . fetch ( prune : nil )
202
+ assert_equal "8496071c1b46c854b31185ea97743be6a8774479" , @repo . ref ( "refs/remotes/origin/unit_test" ) . target_id
203
+ end
204
+
205
+ def test_fetch_prune_nil
206
+ @remote . fetch ( prune : nil )
207
+ assert_equal "8496071c1b46c854b31185ea97743be6a8774479" , @repo . ref ( "refs/remotes/origin/unit_test" ) . target_id
208
+ end
209
+
210
+ def test_fetch_prune_with_invalid_argument_raises
211
+ assert_raises TypeError do
212
+ @remote . fetch ( prune : 'INVALID' )
213
+ end
214
+ end
171
215
end
172
216
173
217
class RemoteWriteTest < Rugged ::TestCase
0 commit comments