Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
bogdanRada committed Jun 17, 2016
1 parent 801a93f commit f86fe48
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/app/controllers/washout_builder_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -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
11 changes: 10 additions & 1 deletion spec/lib/washout_builder/document/generator_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f86fe48

Please sign in to comment.