I have some experience with testing Rails application using Rspec.
But now i tried to write tests for simple gem: https://github.com/regedarek/soup-client
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?
require File.expand_path(File.dirname(FILE) + ‘/spec_helper’)
describe “Soup Client” do
@agent = Soup::Agent.new
it “should connect to soup” do
@agent.host.should == “http://soup.io”
But this spec of course fails.
@@ -1,2 +1,19 @@
# ./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