Sha256: 2c76e521bcc072f700a65180d97f3c50ba89b225f5856e4c6cd4a0cb71630fbb
Contents?: true
Size: 1.55 KB
Versions: 5
Compression:
Stored size: 1.55 KB
Contents
require 'spec_helper' mock_controller do soap_action 'dispatcher_method', args: nil, return: nil def dispatcher_method # nothing end end describe WashoutBuilder::WashoutBuilderController, type: :controller do routes { WashoutBuilder::Engine.routes } let(:soap_config) do OpenStruct.new( camelize_wsdl: false, namespace: '/api/wsdl' ) end let(:washout_builder) { stub(root_url: "#{request.protocol}#{request.host_with_port}/") } let(:route) { stub(defaults: { controller: 'api' }) } let(:params) { { name: 'some_name' } } before(:each) do ApiController.stubs(:soap_config).returns(soap_config) controller.stubs(:washout_builder).returns(washout_builder) end it 'gets the services' do get :all expect(assigns(:services)).to eq([{ 'service_name' => 'Api', 'namespace' => '/api/wsdl', 'endpoint' => '/api/action', 'documentation_url' => '/api/soap_doc' }]) end it 'renders the template' do get :all expect(response).to render_template('wash_with_html/all_services') end it 'checks it controller is a service' do controller.send(:find_all_routes) expect(controller.send(:controller_is_a_service?, 'api')).not_to eq nil end it 'render a service documentation' do controller.stubs(:controller_class).returns(ApiController) controller.stubs(:controller_is_a_service?).with(params[:name]).returns(route) WashoutBuilder::Document::Generator.expects(:new).with(route, route.defaults[:controller]) get :all, params expect(response).to render_template 'wash_with_html/doc' end end
Version data entries
5 entries across 5 versions & 1 rubygems