I use this tool but i can't solve it
Here is my test code:
context 'my test' do
let(:url) { Faker::Internet.url }
let(:response) { [{ name: name, url: url }].to_json }
let(:urls) { [url] }
let(:results) do
Fb::Link.new(
name: name,
url: link,
like_count: 1
)
end
let(:https_urls) { response }
let(:prev_link) { url }
before do
allow(subject).to receive(:process_urls).and_return(response)
end
it 'something' do
expect(subject).to receive(:process_urls) do |link|
expect(link).to eq [url]
end
expect(subject.send(:batch, urls)).to eq []
end
W dniu poniedziałek, 8 czerwca 2015 17:04:38 UTC+2 użytkownik Jason FB
napisał:
>
> 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]
> <javascript:>> 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] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>.
> 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.
>
>
>
--
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/5febde95-e0aa-40b4-8e51-65477b881d12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.