Skip to content

Commit

Permalink
Merge pull request #38 from asonas/feature/update_submodule
Browse files Browse the repository at this point in the history
Update schema file and remove monkey patch
  • Loading branch information
sue445 committed Jan 12, 2018
2 parents ec7e79f + ff5e3fd commit 9bdd1b2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
2 changes: 1 addition & 1 deletion api
Submodule api updated 1 files
+4 −4 RAML/api-ja.raml
17 changes: 0 additions & 17 deletions spec/lib/support/utils/raml_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,4 @@
its(["description"]) { should eq "group chat description" }
its(["icon_preset"]) { should eq "meeting" }
end

describe ".raml" do
subject { RamlParser.raml }

before do
RamlParser.instance_variable_set(:@raml, nil)
end

after do
RamlParser.instance_variable_set(:@raml, nil)
end

it "3 digit number can be read as a string" do
comma_separated_integer_list = subject["traits"][0]["room_members"]["queryParameters"]["members_admin_ids"]["example"]
expect(comma_separated_integer_list).to eq "123,542,1001"
end
end
end
2 changes: 1 addition & 1 deletion spec/support/contexts/api_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def stub_chatwork_request(expected_verb, expected_path, resource_path = nil, sta
query_string = "?" + query_example.to_query
when :post, :put
request_options[:headers]["Content-Type"] = "application/x-www-form-urlencoded"
request_options[:body] = query_example
request_options[:body] = query_example.transform_values(&:to_s)
end
end

Expand Down
10 changes: 2 additions & 8 deletions spec/support/utils/raml_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,9 @@ def self.find_node(elements)
private_class_method :find_node

def self.raml
return @raml if @raml

yaml_data = schema_file.read

# e.g. example: 123,542,1001 -> example: '123,542,1001'
yaml_data.gsub!(/example: ([0-9,]+)/) { "example: '#{Regexp.last_match(1)}'" }

@raml = YAML.safe_load(yaml_data)
@raml ||= YAML.load_file(schema_file)
end
private_class_method :raml

def self.parse_response(response_json)
JSON.parse(response_json)
Expand Down

0 comments on commit 9bdd1b2

Please sign in to comment.