botstack icon indicating copy to clipboard operation
botstack copied to clipboard

Unregistered request during test : thread_settings

Open luizcarvalho opened this issue 8 years ago • 0 comments

I clone the project and when I run rspec, this happens:

Verify the bot with the following verify_token :github
/home/luiz/.rvm/gems/ruby-2.3.3/gems/webmock-2.3.1/lib/webmock/http_lib_adapters/net_http.rb:114:in `request': Real HTTP connections are disabled. Unregistered request: POST https://graph.facebook.com/v2.6/me/thread_settings?access_token= with body '{"setting_type":"call_to_actions","thread_state":"existing_thread","call_to_actions":[{"type":"postback","title":"Reset","payload":"RESET_BOT"},{"type":"postback","title":"Info","payload":"INFO_BOT"}]}' with headers {'Content-Type'=>'application/json'} (WebMock::NetConnectNotAllowedError)

You can stub this request with the following snippet:

stub_request(:post, "https://graph.facebook.com/v2.6/me/thread_settings?access_token=").
  with(:body => "{\"setting_type\":\"call_to_actions\",\"thread_state\":\"existing_thread\",\"call_to_actions\":[{\"type\":\"postback\",\"title\":\"Reset\",\"payload\":\"RESET_BOT\"},{\"type\":\"postback\",\"title\":\"Info\",\"payload\":\"INFO_BOT\"}]}",
       :headers => {'Content-Type'=>'application/json'}).
  to_return(:status => 200, :body => "", :headers => {})
  • Rails 4.2.6
  • ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]

luizcarvalho avatar Oct 13 '17 23:10 luizcarvalho