Skip to content

Commit ae16a1d

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

17 files changed

+146
-142
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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"
@@ -15,7 +15,7 @@ require "time"
1515
# Unit tests for Petstore::FakeApi
1616
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1717
# Please update as you see appropriate
18-
describe "FakeApi" do
18+
Spectator.describe "FakeApi" do
1919
describe "test an instance of FakeApi" do
2020
it "should create an instance of FakeApi" do
2121
api_instance = Petstore::FakeApi.new
@@ -37,5 +37,4 @@ describe "FakeApi" do
3737
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
3838
end
3939
end
40-
4140
end

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

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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"
@@ -15,7 +15,7 @@ require "time"
1515
# Unit tests for Petstore::PetApi
1616
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1717
# Please update as you see appropriate
18-
describe "PetApi" do
18+
Spectator.describe "PetApi" do
1919
describe "test an instance of PetApi" do
2020
it "should create an instance of PetApi" do
2121
api_instance = Petstore::PetApi.new
@@ -45,20 +45,20 @@ describe "PetApi" do
4545
new_pet = Petstore::Pet.new(id: nil, category: nil, name: pet_name, photo_urls: Array(String).new, tags: nil, status: nil)
4646

4747
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
48+
expect(pet.id).to_not be_nil
49+
expect(pet.category).to be_nil
50+
expect(pet.name).to eq pet_name
51+
expect(pet.photo_urls).to eq Array(String).new
52+
expect(pet.status).to be_nil
53+
expect(pet.tags).to eq Array(Petstore::Tag).new
5454
end
5555
end
5656

5757
# unit tests for delete_pet
5858
# Deletes a pet
5959
# @param pet_id Pet id to delete
6060
# @param [Hash] opts the optional parameters
61-
# @option opts [String] :api_key
61+
# @option opts [String] :api_key
6262
# @return [nil]
6363
describe "delete_pet test" do
6464
it "should work" do
@@ -114,12 +114,12 @@ describe "PetApi" do
114114
pet = api_instance.add_pet(new_pet)
115115
pet_id = pet.id.not_nil!
116116
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
117+
expect(result.id).to eq pet_id
118+
expect(result.category).to be_nil
119+
expect(result.name).to eq "crystal"
120+
expect(result.photo_urls).to eq Array(String).new
121+
expect(result.status).to be_nil
122+
expect(result.tags).to eq Array(Petstore::Tag).new
123123
end
124124
end
125125

@@ -159,5 +159,4 @@ describe "PetApi" do
159159
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
160160
end
161161
end
162-
163162
end

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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"
@@ -15,7 +15,7 @@ require "time"
1515
# Unit tests for Petstore::StoreApi
1616
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1717
# Please update as you see appropriate
18-
describe "StoreApi" do
18+
Spectator.describe "StoreApi" do
1919
describe "test an instance of StoreApi" do
2020
it "should create an instance of StoreApi" do
2121
api_instance = Petstore::StoreApi.new
@@ -60,7 +60,7 @@ describe "StoreApi" do
6060

6161
# unit tests for place_order
6262
# Place an order for a pet
63-
#
63+
#
6464
# @param order order placed for purchasing the pet
6565
# @param [Hash] opts the optional parameters
6666
# @return [Order]
@@ -69,5 +69,4 @@ describe "StoreApi" do
6969
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
7070
end
7171
end
72-
7372
end

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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"
@@ -15,7 +15,7 @@ require "time"
1515
# Unit tests for Petstore::UserApi
1616
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1717
# Please update as you see appropriate
18-
describe "UserApi" do
18+
Spectator.describe "UserApi" do
1919
describe "test an instance of UserApi" do
2020
it "should create an instance of UserApi" do
2121
api_instance = Petstore::UserApi.new
@@ -37,7 +37,7 @@ describe "UserApi" do
3737

3838
# unit tests for create_users_with_array_input
3939
# Creates list of users with given input array
40-
#
40+
#
4141
# @param user List of user object
4242
# @param [Hash] opts the optional parameters
4343
# @return [nil]
@@ -49,7 +49,7 @@ describe "UserApi" do
4949

5050
# unit tests for create_users_with_list_input
5151
# Creates list of users with given input array
52-
#
52+
#
5353
# @param user List of user object
5454
# @param [Hash] opts the optional parameters
5555
# @return [nil]
@@ -73,7 +73,7 @@ describe "UserApi" do
7373

7474
# unit tests for get_user_by_name
7575
# Get user by user name
76-
#
76+
#
7777
# @param username The name that needs to be fetched. Use user1 for testing.
7878
# @param [Hash] opts the optional parameters
7979
# @return [User]
@@ -85,7 +85,7 @@ describe "UserApi" do
8585

8686
# unit tests for login_user
8787
# Logs user into the system
88-
#
88+
#
8989
# @param username The user name for login
9090
# @param password The password for login in clear text
9191
# @param [Hash] opts the optional parameters
@@ -98,7 +98,7 @@ describe "UserApi" do
9898

9999
# unit tests for logout_user
100100
# Logs out current logged in user session
101-
#
101+
#
102102
# @param [Hash] opts the optional parameters
103103
# @return [nil]
104104
describe "logout_user test" do
@@ -119,5 +119,4 @@ describe "UserApi" do
119119
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
120120
end
121121
end
122-
123122
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: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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"
@@ -15,12 +15,11 @@ require "time"
1515
# Unit tests for Petstore::AnotherPropertyNameMapping
1616
# Automatically generated by openapi-generator (https://openapi-generator.tech)
1717
# Please update as you see appropriate
18-
describe Petstore::AnotherPropertyNameMapping do
19-
18+
Spectator.describe Petstore::AnotherPropertyNameMapping do
2019
describe "test an instance of AnotherPropertyNameMapping" do
2120
it "should create an instance of AnotherPropertyNameMapping" do
22-
#instance = Petstore::AnotherPropertyNameMapping.new
23-
#expect(instance).to be_instance_of(Petstore::AnotherPropertyNameMapping)
21+
# instance = Petstore::AnotherPropertyNameMapping.new
22+
# expect(instance).to be_instance_of(Petstore::AnotherPropertyNameMapping)
2423
end
2524
end
2625
describe "test attribute 'http_debug_operation'" do
@@ -46,5 +45,4 @@ describe Petstore::AnotherPropertyNameMapping do
4645
# assertion here. ref: https://crystal-lang.org/reference/guides/testing.html
4746
end
4847
end
49-
5048
end

0 commit comments

Comments
 (0)