describe "changes shopping array length" do
subject { described_class.new.change_array_length(group: [], num: 2) }
it "by responding to a method with arguments" do
expect(subject).to respond_to(:change_array_length).with(2).arguments
end
This is what I have written so far. However, when I run the test I get:
Failure/Error:
def change_array_length(group, num)
group << num
end
ArgumentError:
wrong number of arguments (given 1, expected 2)
I removed the num argument and the number of arguments goes down to 0 so it's not reading the empty array.
I've just started learning testing with a course using Ruby not RoR so let me know if I have this slightly wrong for testing the method with arguments!
Thanks!