How to test wash_out controller using rspec

I implemented a Rails controller with a wash_out gem.

My controller looks like this:

class TestController < ApplicationController
  include WashOut::SOAP

  soap_action "int_to_string",
              :args   => :integer,
              :return => :string
  def int_to_string
    render :soap => params[:value].to_s
  end
end

routes.rb:

MyApp::Application.routes.draw do
  wash_out :test
end

I'm not sure how I can test this controller using rspec.

Any ideas?

+5
source share
2 answers

In this link you can find a good aproach

http://blog.johnsonch.com/2013/04/18/rails-3-soap-and-testing-oh-my/

Subroutine:

  • Create Savonrb Gem Client
  • compare the result in your test
+2
source

you can specify the default wsdl route with something like:

 require "spec_helper"

describe MywsdlController do
  describe "routing" do

    it "mywsdl/wsdl route to mywsdl#_generate_wsdl" do 
      get("/mywsdl/wsdl").should route_to("mywsdl#_generate_wsdl")
    end

  end
end

Id spec , soap- : , .

0

All Articles