Skip to content

Commit 551bafb

Browse files
committed
Refactor tests to not use self or same variable names.
1 parent 46c0a90 commit 551bafb

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

spec/ruby/optional/capi/ext/object_spec.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,13 @@ static VALUE object_spec_rb_ivar_defined(VALUE self, VALUE obj, VALUE sym_name)
327327
return rb_ivar_defined(obj, SYM2ID(sym_name));
328328
}
329329

330-
static VALUE object_spec_rb_copy_generic_ivar(VALUE self, VALUE obj) {
331-
rb_copy_generic_ivar(self, obj);
330+
static VALUE object_spec_rb_copy_generic_ivar(VALUE self, VALUE clone, VALUE obj) {
331+
rb_copy_generic_ivar(clone, obj);
332332
return self;
333333
}
334334

335-
static VALUE object_spec_rb_free_generic_ivar(VALUE self) {
336-
rb_free_generic_ivar(self);
335+
static VALUE object_spec_rb_free_generic_ivar(VALUE self, VALUE obj) {
336+
rb_free_generic_ivar(obj);
337337
return self;
338338
}
339339

@@ -410,8 +410,8 @@ void Init_object_spec(void) {
410410
rb_define_method(cls, "rb_ivar_get", object_spec_rb_ivar_get, 2);
411411
rb_define_method(cls, "rb_ivar_set", object_spec_rb_ivar_set, 3);
412412
rb_define_method(cls, "rb_ivar_defined", object_spec_rb_ivar_defined, 2);
413-
rb_define_method(cls, "rb_copy_generic_ivar", object_spec_rb_copy_generic_ivar, 1);
414-
rb_define_method(cls, "rb_free_generic_ivar", object_spec_rb_free_generic_ivar, 0);
413+
rb_define_method(cls, "rb_copy_generic_ivar", object_spec_rb_copy_generic_ivar, 2);
414+
rb_define_method(cls, "rb_free_generic_ivar", object_spec_rb_free_generic_ivar, 1);
415415
}
416416

417417
#ifdef __cplusplus

spec/ruby/optional/capi/object_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,16 +858,18 @@ def reach
858858
it "copies the instance variables from one object to another" do
859859
original = Object.new
860860
original.instance_variable_set(:@foo, :bar)
861-
@o.rb_copy_generic_ivar(original)
862-
@o.instance_variable_get(:@foo).should == :bar
861+
clone = Object.new
862+
@o.rb_copy_generic_ivar(clone, original)
863+
clone.instance_variable_get(:@foo).should == :bar
863864
end
864865
end
865866

866867
describe "rb_free_generic_ivar" do
867868
it "removes the instance variables from an object" do
868-
@o.instance_variable_set(:@foo, :bar)
869-
@o.rb_free_generic_ivar
870-
@o.instance_variables.should == []
869+
o = Object.new
870+
o.instance_variable_set(:@baz, :flibble)
871+
@o.rb_free_generic_ivar(o)
872+
o.instance_variables.should == []
871873
end
872874
end
873875
end

0 commit comments

Comments
 (0)