diff --git a/spec/app/controllers/washout_builder_controller_spec.rb b/spec/app/controllers/washout_builder_controller_spec.rb index bd16ad0..8de53b1 100644 --- a/spec/app/controllers/washout_builder_controller_spec.rb +++ b/spec/app/controllers/washout_builder_controller_spec.rb @@ -27,7 +27,7 @@ def dispatcher_method it 'gets the services' do get :all - expect(assigns(:services)).to eq([{ 'service_name' => 'Api', 'namespace' => '/api/wsdl', 'endpoint' => '/api/action', 'documentation_url' => 'http://test.host/Api' }]) + 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 @@ -43,7 +43,7 @@ def dispatcher_method 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.defaults[:controller]) + WashoutBuilder::Document::Generator.expects(:new).with(route, route.defaults[:controller]) get :all, params expect(response).to render_template 'wash_with_html/doc' end diff --git a/spec/lib/washout_builder/document/generator_spec.rb b/spec/lib/washout_builder/document/generator_spec.rb index 59cc9ca..deefb99 100644 --- a/spec/lib/washout_builder/document/generator_spec.rb +++ b/spec/lib/washout_builder/document/generator_spec.rb @@ -29,8 +29,17 @@ def dispatcher_method3 end let(:service_class) { ApiController } + let(:route_details) { mock } + let(:route_set) { mock } + let(:route_url_helpers) { mock } + + before(:each) do + route_details.stubs(:[]).with(:route_set).returns(route_set) + route_set.stubs(:url_helpers).returns(route_url_helpers) + route_url_helpers.stubs(:url_for).returns(soap_config.namespace) + end before(:each) do - @document = WashoutBuilder::Document::Generator.new('api') + @document = WashoutBuilder::Document::Generator.new(route_details, 'api') @document.stubs(:controller_class).returns(service_class) end