This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Allows Scry to receive the initialized notification - Adds new param type VoidParams which is an empty JSON object used by the initialized notification
- Loading branch information
1 parent
55c7e8f
commit f525b12
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "../../spec_helper" | ||
|
||
module Scry | ||
describe VoidParams do | ||
it "creates from json" do | ||
void_params = VoidParams.from_json("{}") | ||
void_params.is_a?(VoidParams).should be_true | ||
end | ||
|
||
it "raises a JSON::ParseException if non empty JSON is supplied" do | ||
expect_raises(JSON::ParseException) do | ||
void_params = VoidParams.from_json(%({ "key": "value" })) | ||
end | ||
end | ||
|
||
it "will render as JSON" do | ||
void_params = VoidParams.from_json("{}") | ||
void_params.to_json.should eq("{}") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "json" | ||
|
||
module Scry | ||
struct VoidParams | ||
def initialize(pull : JSON::PullParser) | ||
pull.read_begin_object | ||
pull.read_end_object | ||
end | ||
|
||
def to_json(json : ::JSON::Builder) | ||
json.object { nil } | ||
end | ||
end | ||
end |