How to start write test for gems?

Hi, I have some experience with testing Rails application using Rspec.

But now i tried to write tests for simple gem: GitHub - regedarek/soup-client: Client for soup.io. Based on faraday I know it will not be easy, but i want to learn this. Could you give me some tips or send some links how to started or example of good simple tests in gems because this is i think much more difficult then testing web applications.

What should i test first? In first spec i think I should check Agent class?

agent_spec.rb

require File.expand_path(File.dirname(FILE) + ‘/spec_helper’)

describe “Soup Client” do before do @agent = Soup::Agent.new end it “should connect to soup” do @agent.host.should == “http://soup.io” end end

But this spec of course fails.

@@ -1,2 +1,19 @@ -“http://soup.io” +#<Soup::Agent:0xa87f8ac + @agent= + #<Faraday::Connection:0xa87f834 + @builder= + #<Faraday::Builder:0xa87f58c + @handlers= + [Faraday::Request::UrlEncoded, + Faraday::Response::Logger, + Faraday::Adapter::NetHttp]>, + @headers={}, + @host=“www.soup.io”, + @options={}, + @parallel_manager=nil, + @params={}, + @path_prefix=“/”, + @port=nil, + @scheme=“https”, + @ssl={}>> # ./spec/soup_spec.rb:8:in `block (2 levels) in <top (required)>’

I would like to learn how to get access to this variables like @host @builder and how to test each one. Any tips?

Thanks in advance