Hi,
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?
> # 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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/_bXLwwVC8psJ.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.