Home > Uncategorized > Integration Tests for Web Services Using RSpec

Integration Tests for Web Services Using RSpec

CodePlease

Recently I had to implement a REST web service for a project in Rails. I’ve been using RSpec for every kind of tests for a long time but, still, wasn’t sure on what was the best way to use it to test a web service.

Capybara has always been my first choice for integration tests, but it doesn’t make much sense if your views are just plain JSON. Thus, I went for a leaner approach taking advantage of Rack::Test::Methods.

In this post I will explain my approach to test a web service. I won’t get into any details on how the web service in question could or should be implemented.

Setup

The first thing to setup is the filesystem. There are infinite ways to do this, I prefer to keep the API tests isolated from the rest of the application.

I guess it would also make sense to decide…

View original post 352 more words

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: