instagram_api_gem
instagram_api_gem copied to clipboard
Adding some testing
Hi, I was working in a personal project and just discovered this gem and noticed that there's a TODO section in the readme file and I would like to start adding some testing. Let me know if you have any advice.
Hi there! Sorry for the delay with answer. Sure. you're welcome to make pull request and add some test suits. I'll merge your changes. I don't have any advice for now. Please, concretize or we can start just from the code. Looking forward for your pull requests.
Hi Sergey, I started with the User class. I was trying to test the initializer method when realized that there is no attr_accessor for :user_id so :
context 'initialize' do
it 'sets user_id when id is specified' do
user = InstagramApi::User.new('123')
expect(user.user_id).to eq('123')
end
end
Results in a NoMethodError:
undefined method
user_id' for #<InstagramApi::User:0x0000000357d980 @user_id="123">`
But with the attr_accessor the test pass, is there any reason to the lack of it? Should avoid testing the initializer or should add attr_accessor?