Skip to content

Commit 444963a

Browse files
committed
fix(crystal): update sample app specs
1 parent cdca60b commit 444963a

17 files changed

+152
-166
lines changed

samples/client/petstore/crystal/shard.lock

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
version: 2.0
22
shards:
3+
ameba:
4+
git: https://github.com/crystal-ameba/ameba.git
5+
version: 1.6.4
6+
7+
backtracer:
8+
git: https://github.com/sija/backtracer.cr.git
9+
version: 1.2.4
10+
311
crest:
412
git: https://github.com/mamantoha/crest.git
513
version: 1.3.13
614

15+
exception_page:
16+
git: https://github.com/crystal-loot/exception_page.git
17+
version: 0.4.1
18+
719
http-client-digest_auth:
820
git: https://github.com/mamantoha/http-client-digest_auth.git
921
version: 0.6.0
@@ -12,3 +24,15 @@ shards:
1224
git: https://github.com/mamantoha/http_proxy.git
1325
version: 0.10.3
1426

27+
kemal:
28+
git: https://github.com/kemalcr/kemal.git
29+
version: 1.5.0
30+
31+
radix:
32+
git: https://github.com/luislavena/radix.git
33+
version: 0.4.1
34+
35+
spectator:
36+
git: https://gitlab.com/arctic-fox/spectator.git
37+
version: 0.12.1
38+

samples/client/petstore/crystal/spec/api/fake_api_spec.cr

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# #OpenAPI Petstore
22
#
3-
##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
3+
# #This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
44
#
5-
#The version of the OpenAPI document: 1.0.0
5+
# The version of the OpenAPI document: 1.0.0
66
#
7-
#Generated by: https://openapi-generator.tech
8-
#Generator version: 7.11.0-SNAPSHOT
7+
# Generated by: https://openapi-generator.tech
8+
# Generator version: 7.11.0-SNAPSHOT
99
#
1010

1111
require "../spec_helper"
12-
require "json"
13-
require "time"
1412

1513
# Unit tests for Petstore::FakeApi
1614
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1715
# Please update as you see appropriate
18-
describe "FakeApi" do
16+
Spectator.describe "FakeApi" do
1917
describe "test an instance of FakeApi" do
2018
it "should create an instance of FakeApi" do
2119
api_instance = Petstore::FakeApi.new
@@ -37,5 +35,4 @@ describe "FakeApi" do
3735
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
3836
end
3937
end
40-
4138
end

samples/client/petstore/crystal/spec/api/pet_api_spec.cr

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# #OpenAPI Petstore
22
#
3-
##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
3+
# #This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
44
#
5-
#The version of the OpenAPI document: 1.0.0
5+
# The version of the OpenAPI document: 1.0.0
66
#
7-
#Generated by: https://openapi-generator.tech
8-
#OpenAPI Generator version: 5.0.1-SNAPSHOT
7+
# Generated by: https://openapi-generator.tech
8+
# OpenAPI Generator version: 5.0.1-SNAPSHOT
99
#
1010

1111
require "../spec_helper"
12-
require "json"
13-
require "time"
1412

1513
# Unit tests for Petstore::PetApi
1614
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1715
# Please update as you see appropriate
18-
describe "PetApi" do
16+
Spectator.describe "PetApi" do
1917
describe "test an instance of PetApi" do
2018
it "should create an instance of PetApi" do
2119
api_instance = Petstore::PetApi.new
@@ -45,20 +43,20 @@ describe "PetApi" do
4543
new_pet = Petstore::Pet.new(id: nil, category: nil, name: pet_name, photo_urls: Array(String).new, tags: nil, status: nil)
4644

4745
pet = api_instance.add_pet(new_pet)
48-
pet.id.should_not be_nil
49-
pet.category.should be_nil
50-
pet.name.should eq pet_name
51-
pet.photo_urls.should eq Array(String).new
52-
pet.status.should be_nil
53-
pet.tags.should eq Array(Petstore::Tag).new
46+
expect(pet.id).to_not be_nil
47+
expect(pet.category).to be_nil
48+
expect(pet.name).to eq pet_name
49+
expect(pet.photo_urls).to eq Array(String).new
50+
expect(pet.status).to be_nil
51+
expect(pet.tags).to eq Array(Petstore::Tag).new
5452
end
5553
end
5654

5755
# unit tests for delete_pet
5856
# Deletes a pet
5957
# @param pet_id Pet id to delete
6058
# @param [Hash] opts the optional parameters
61-
# @option opts [String] :api_key
59+
# @option opts [String] :api_key
6260
# @return [nil]
6361
describe "delete_pet test" do
6462
it "should work" do
@@ -114,12 +112,12 @@ describe "PetApi" do
114112
pet = api_instance.add_pet(new_pet)
115113
pet_id = pet.id.not_nil!
116114
result = api_instance.get_pet_by_id(pet_id: pet_id)
117-
result.id.should eq pet_id
118-
result.category.should be_nil
119-
result.name.should eq "crystal"
120-
result.photo_urls.should eq Array(String).new
121-
result.status.should be_nil
122-
result.tags.should eq Array(Petstore::Tag).new
115+
expect(result.id).to eq pet_id
116+
expect(result.category).to be_nil
117+
expect(result.name).to eq "crystal"
118+
expect(result.photo_urls).to eq Array(String).new
119+
expect(result.status).to be_nil
120+
expect(result.tags).to eq Array(Petstore::Tag).new
123121
end
124122
end
125123

@@ -159,5 +157,4 @@ describe "PetApi" do
159157
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
160158
end
161159
end
162-
163160
end

samples/client/petstore/crystal/spec/api/store_api_spec.cr

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# #OpenAPI Petstore
22
#
3-
##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
3+
# #This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
44
#
5-
#The version of the OpenAPI document: 1.0.0
5+
# The version of the OpenAPI document: 1.0.0
66
#
7-
#Generated by: https://openapi-generator.tech
8-
#Generator version: 7.11.0-SNAPSHOT
7+
# Generated by: https://openapi-generator.tech
8+
# Generator version: 7.11.0-SNAPSHOT
99
#
1010

1111
require "../spec_helper"
12-
require "json"
13-
require "time"
1412

1513
# Unit tests for Petstore::StoreApi
1614
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1715
# Please update as you see appropriate
18-
describe "StoreApi" do
16+
Spectator.describe "StoreApi" do
1917
describe "test an instance of StoreApi" do
2018
it "should create an instance of StoreApi" do
2119
api_instance = Petstore::StoreApi.new
@@ -60,7 +58,7 @@ describe "StoreApi" do
6058

6159
# unit tests for place_order
6260
# Place an order for a pet
63-
#
61+
#
6462
# @param order order placed for purchasing the pet
6563
# @param [Hash] opts the optional parameters
6664
# @return [Order]
@@ -69,5 +67,4 @@ describe "StoreApi" do
6967
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
7068
end
7169
end
72-
7370
end

samples/client/petstore/crystal/spec/api/user_api_spec.cr

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# #OpenAPI Petstore
22
#
3-
##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
3+
# #This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
44
#
5-
#The version of the OpenAPI document: 1.0.0
5+
# The version of the OpenAPI document: 1.0.0
66
#
7-
#Generated by: https://openapi-generator.tech
8-
#Generator version: 7.11.0-SNAPSHOT
7+
# Generated by: https://openapi-generator.tech
8+
# Generator version: 7.11.0-SNAPSHOT
99
#
1010

1111
require "../spec_helper"
12-
require "json"
13-
require "time"
1412

1513
# Unit tests for Petstore::UserApi
1614
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1715
# Please update as you see appropriate
18-
describe "UserApi" do
16+
Spectator.describe "UserApi" do
1917
describe "test an instance of UserApi" do
2018
it "should create an instance of UserApi" do
2119
api_instance = Petstore::UserApi.new
@@ -37,7 +35,7 @@ describe "UserApi" do
3735

3836
# unit tests for create_users_with_array_input
3937
# Creates list of users with given input array
40-
#
38+
#
4139
# @param user List of user object
4240
# @param [Hash] opts the optional parameters
4341
# @return [nil]
@@ -49,7 +47,7 @@ describe "UserApi" do
4947

5048
# unit tests for create_users_with_list_input
5149
# Creates list of users with given input array
52-
#
50+
#
5351
# @param user List of user object
5452
# @param [Hash] opts the optional parameters
5553
# @return [nil]
@@ -73,7 +71,7 @@ describe "UserApi" do
7371

7472
# unit tests for get_user_by_name
7573
# Get user by user name
76-
#
74+
#
7775
# @param username The name that needs to be fetched. Use user1 for testing.
7876
# @param [Hash] opts the optional parameters
7977
# @return [User]
@@ -85,7 +83,7 @@ describe "UserApi" do
8583

8684
# unit tests for login_user
8785
# Logs user into the system
88-
#
86+
#
8987
# @param username The user name for login
9088
# @param password The password for login in clear text
9189
# @param [Hash] opts the optional parameters
@@ -98,7 +96,7 @@ describe "UserApi" do
9896

9997
# unit tests for logout_user
10098
# Logs out current logged in user session
101-
#
99+
#
102100
# @param [Hash] opts the optional parameters
103101
# @return [nil]
104102
describe "logout_user test" do
@@ -119,5 +117,4 @@ describe "UserApi" do
119117
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
120118
end
121119
end
122-
123120
end

samples/client/petstore/crystal/spec/api_client_spec.cr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "./spec_helper"
22

3-
describe Petstore::ApiClient do
3+
Spectator.describe Petstore::ApiClient do
44
describe "#update_params_for_auth!" do
55
describe "oauth2" do
66
it "should add 'Authorization' to header" do
@@ -13,8 +13,8 @@ describe Petstore::ApiClient do
1313
api_client = Petstore::ApiClient.new(config)
1414
api_client.update_params_for_auth!(header_params, query_params, ["petstore_auth"])
1515

16-
header_params["Authorization"].should eq "Bearer xxx"
17-
query_params.size.should eq 0
16+
expect(header_params["Authorization"]).to eq "Bearer xxx"
17+
expect(query_params.size).to eq 0
1818
end
1919
end
2020

@@ -30,8 +30,8 @@ describe Petstore::ApiClient do
3030
api_client = Petstore::ApiClient.new(config)
3131
api_client.update_params_for_auth!(header_params, query_params, ["api_key"])
3232

33-
header_params["api_key"].should eq "xxx"
34-
query_params.empty?.should be_true
33+
expect(header_params["api_key"]).to eq "xxx"
34+
expect(query_params.empty?).to be_true
3535
end
3636
end
3737

@@ -47,8 +47,8 @@ describe Petstore::ApiClient do
4747
api_client = Petstore::ApiClient.new(config)
4848
api_client.update_params_for_auth!(header_params, query_params, ["api_key"])
4949

50-
header_params["api_key"].should eq "Token xxx"
51-
query_params.empty?.should be_true
50+
expect(header_params["api_key"]).to eq "Token xxx"
51+
expect(query_params.empty?).to be_true
5252
end
5353
end
5454
end

samples/client/petstore/crystal/spec/configuration_spec.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
require "./spec_helper"
22

3-
describe Petstore::Configuration do
3+
Spectator.describe Petstore::Configuration do
44
describe "#initialize" do
55
context "with block" do
66
it "works" do
77
config = Petstore::Configuration.new do |config|
88
config.username = "xxx"
99
end
1010

11-
config.username.should eq "xxx"
11+
expect(config.username).to eq "xxx"
1212
end
1313
end
1414
end
@@ -20,7 +20,7 @@ describe Petstore::Configuration do
2020
config.username = "xxx"
2121
end
2222

23-
config.username.should eq "xxx"
23+
expect(config.username).to eq "xxx"
2424
end
2525
end
2626
end

samples/client/petstore/crystal/spec/models/another_property_name_mapping_spec.cr

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
# #OpenAPI Petstore
22
#
3-
##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
3+
# #This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
44
#
5-
#The version of the OpenAPI document: 1.0.0
5+
# The version of the OpenAPI document: 1.0.0
66
#
7-
#Generated by: https://openapi-generator.tech
8-
#Generator version: 7.11.0-SNAPSHOT
7+
# Generated by: https://openapi-generator.tech
8+
# Generator version: 7.11.0-SNAPSHOT
99
#
1010

1111
require "../spec_helper"
12-
require "json"
13-
require "time"
1412

1513
# Unit tests for Petstore::AnotherPropertyNameMapping
1614
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1715
# Please update as you see appropriate
18-
describe Petstore::AnotherPropertyNameMapping do
19-
16+
Spectator.describe Petstore::AnotherPropertyNameMapping do
2017
describe "test an instance of AnotherPropertyNameMapping" do
2118
it "should create an instance of AnotherPropertyNameMapping" do
22-
#instance = Petstore::AnotherPropertyNameMapping.new
23-
#expect(instance).to be_instance_of(Petstore::AnotherPropertyNameMapping)
19+
# instance = Petstore::AnotherPropertyNameMapping.new
20+
# expect(instance).to be_instance_of(Petstore::AnotherPropertyNameMapping)
2421
end
2522
end
23+
2624
describe "test attribute 'http_debug_operation'" do
2725
it "should work" do
2826
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
@@ -46,5 +44,4 @@ describe Petstore::AnotherPropertyNameMapping do
4644
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
4745
end
4846
end
49-
5047
end

0 commit comments

Comments
 (0)