0

I want to write a spec for omniauth with vcr like this.

  describe "Omniauth" do
    describe "Twitter" do
      VCR.use_cassette 'omniauth/twitter' do
        auth = visit 'users/auth/twitter'
        auth.info.name.should exist
      end
    end
  end

This cause error undefined method 'visit', and I found it is very tricky to use capybara and vcr at the same.

vcr with capybara-webkit

So I'm going to write visit function without capybara. But I don't know how to write it. Could anyone help me?

Edit 2014/01/19

This question is voted closed because my question was not clear, so I add more details.

vcr uses rack server and so is capybara, therefore normally I can't use Capybara's visit method inside of VCR.use_cassette method.

I want to know equivalent of visit method that is using only pure rspec method.

Community
  • 1
  • 1
ironsand
  • 14,329
  • 17
  • 83
  • 176
  • How about this article? http://betterspecs.org/#http – tkymtk Jan 09 '14 at 10:10
  • I think, the article explains how to use stub that is created already. But I want to create stub itself by using `vcr` in spec file. Thanks your reply anyway. – ironsand Jan 09 '14 at 11:38

1 Answers1

0

You can try using Rack::Test and its #get method. It's usually used with plain Rack apps like Sinatra, but it's also good for general API testing etc.

Here's a link to some steps to use it with Sinatra, the same applies for any Rack-based app though: http://www.sinatrarb.com/testing.html

xiy
  • 808
  • 6
  • 13