Create some fake data (inputs), call your code, and then assert that the output 
(results) are what you expect. That’s fundamentally the concept behind all 
testing. 

I love and use SimpleCOV, a gem which shows you line-by-line what you have 
written test coverage for (it does not show you that you wrote the correct 
test, just that the line of code was covered). IMHO, SimpleCov should be a 
standard part of every Rails’ developer toolkit and is invaluable when you are 
learning. 

-Jason



> On Jun 8, 2015, at 10:43 AM, Krzych0o <[email protected]> wrote:
> 
> Hi!
> 
> I have no idea how to test bellow code:
> 
> process_urls(urls) do |link|
>     results[link.url] = link
>  end
> 
> 
> https_urls = results
>         .select { |_url, link| link.youtube? }
>         .map { |url, _link| "https://#{url}"; }
> 
> Could you help me to solve this ?
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rspec/9766e61d-9b19-437a-8651-7039fbb2b2c8%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rspec/9766e61d-9b19-437a-8651-7039fbb2b2c8%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/B7EEBD86-84A9-4C3F-A6D8-DDD04E3A20DC%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to