From 6ebe6f56804e9981758f14fd2d920a2280018e90 Mon Sep 17 00:00:00 2001 From: Daniel Carneiro Date: Wed, 13 Jan 2016 21:04:49 +0000 Subject: [PATCH 1/2] remove misplaced new line --- swagger-docs.gemspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/swagger-docs.gemspec b/swagger-docs.gemspec index c8d5353..94ba8f2 100644 --- a/swagger-docs.gemspec +++ b/swagger-docs.gemspec @@ -9,8 +9,7 @@ Gem::Specification.new do |spec| spec.authors = ["Rich Hollis"] spec.email = ["richhollis@gmail.com"] spec.description = %q{Generates json files for rails apps to use with swagger-ui} - spec.summary = %q{Generates swagger-ui json files for rails apps with APIs. You add the swagger DSL to your controller classes and then run one rake task to generate the json files. -} + spec.summary = %q{Generates swagger-ui json files for rails apps with APIs. You add the swagger DSL to your controller classes and then run one rake task to generate the json files.} spec.homepage = "https://github.com/richhollis/swagger-docs" spec.license = "MIT" From 0a408d1f9b966544b7a9873dd89c72a2ab7b2c5d Mon Sep 17 00:00:00 2001 From: Daniel Carneiro Date: Tue, 19 Jan 2016 21:34:40 +0000 Subject: [PATCH 2/2] Accept ok status --- lib/swagger/docs/dsl.rb | 4 ++-- spec/lib/swagger/docs/dsl_spec.rb | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/swagger/docs/dsl.rb b/lib/swagger/docs/dsl.rb index be83ef2..29b3436 100644 --- a/lib/swagger/docs/dsl.rb +++ b/lib/swagger/docs/dsl.rb @@ -62,7 +62,7 @@ def response_messages def response(status, text = nil, model = nil) if status.is_a? Symbol - status == :ok if status == :success + status = :ok if status == :success status_code = Rack::Utils.status_code(status) response_messages << {:code => status_code, :responseModel => model, :message => text || status.to_s.titleize} else @@ -108,7 +108,7 @@ def property(name, type, required, description = nil, hash={}) }.merge!(hash) self.required << name if required == :required end - + # helper method to generate enums def property_list(name, type, required, description = nil, allowed_values = [], hash = {}) hash.merge!({allowable_values: {value_type: "LIST", values: allowed_values}}) diff --git a/spec/lib/swagger/docs/dsl_spec.rb b/spec/lib/swagger/docs/dsl_spec.rb index 139db0b..df5f7d7 100644 --- a/spec/lib/swagger/docs/dsl_spec.rb +++ b/spec/lib/swagger/docs/dsl_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' describe Swagger::Docs::SwaggerDSL do - subject { described_class.new() } describe "#response" do @@ -9,7 +8,10 @@ subject.response(:ok, "Some sample text", "Tag") expect(subject.response_messages).to eq([{:code=>200, :responseModel=>"Tag", :message=>"Some sample text"}]) end - end + it "accept :success was an :ok status" do + subject.response(:success, "Some sample text", "Tag") + expect(subject.response_messages).to eq([{:code=>200, :responseModel=>"Tag", :message=>"Some sample text"}]) + end + end end -