Skip to content

Commit

Permalink
Make default config a let value in generator spec
Browse files Browse the repository at this point in the history
  • Loading branch information
richhollis committed Jan 15, 2016
1 parent ae58f30 commit bdb4765
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions spec/lib/swagger/docs/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 32,22 @@
let(:file_resource_nested) { tmp_dir 'nested.json' }
let(:file_resource_custom_resource_path) { tmp_dir 'custom_resource_path.json' }

let(:default_config) {
{
:controller_base_path => "api/v1", :api_file_path => "#{tmp_dir}", :base_path => "http://api.no.where/",
:attributes => {
:info => {
"title" => "Swagger Sample App",
"description" => "This is a sample description.",
"termsOfServiceUrl" => "http://helloreverb.com/terms/",
"contact" => "[email protected]",
"license" => "Apache 2.0",
"licenseUrl" => "http://www.apache.org/licenses/LICENSE-2.0.html"
}
}
}
}

let(:controllers) { [
"fixtures/controllers/sample_controller",
"fixtures/controllers/nested_controller",
Expand Down Expand Up @@ -100,20 116,7 @@
end
end
context "with controller base path" do
let(:config) { Swagger::Docs::Config.register_apis({
DEFAULT_VER => {:controller_base_path => "api/v1", :api_file_path => "#{tmp_dir}", :base_path => "http://api.no.where/",
:attributes => {
:info => {
"title" => "Swagger Sample App",
"description" => "This is a sample description.",
"termsOfServiceUrl" => "http://helloreverb.com/terms/",
"contact" => "[email protected]",
"license" => "Apache 2.0",
"licenseUrl" => "http://www.apache.org/licenses/LICENSE-2.0.html"
}
}
}
})}
let(:config) { Swagger::Docs::Config.register_apis({DEFAULT_VER => default_config})}
let(:file_resource) { tmp_dir 'sample.json' }
let(:resource) { file_resource.read }
let(:response) { JSON.parse(resource) }
Expand Down

0 comments on commit bdb4765

Please sign in to comment.