dimanche 10 juillet 2016

Rspec testing inside a loop

I am trying to test the code inside a loop, how would I go about this:

class MyClass
  def initialize(topics, env, config, limit)
    @client = Twitter::Streaming::Client.new(config)
    @topics = topics
    @env = env
    @limit = limit
  end

 def start
   @client.filter(track: @topics.join(",")) do |object|
   # how would I test the code inside here, basically logical stuff
    next if !object.is_a?(Twitter::Tweet)

   # get the coupon code now
   txt = get_txt(object.text)
  end
end

Is there a way to do this?

Aucun commentaire:

Enregistrer un commentaire