Im developing a ruby API library for some web application (not rails based).
Library (in short overview) consists of the following objects:
- Client - main api class
- Request - module that handles all data transfers
- Item (record) - object with attributes (result of api operations)
Im having a hard time figuring out whats the best way to test such libraries?
Currently using RSpec2 and actual (live) requests. But also might use fixtures.
Any suggestions?
You can use WebMock to mock requests. It has RSpec helpers to aid you in your tests.
I haven't personally used WebMock, but once used Fakeweb to accomplish a similar task. The only disadvantage of using mock requests is that if the remote code changes,