|
@ -6,6 +6,42 @@ describe SalesBackend do |
|
|
String.from_json(Global.response.not_nil!.body).should eq "OK" |
|
|
String.from_json(Global.response.not_nil!.body).should eq "OK" |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "can compare addresses" do |
|
|
|
|
|
address_str1 = Address.from_json %( |
|
|
|
|
|
{ |
|
|
|
|
|
"name": "String", |
|
|
|
|
|
"address1": "String", |
|
|
|
|
|
"address2": "{type: String, nilable: true}", |
|
|
|
|
|
"postcode": "00001", |
|
|
|
|
|
"city": "String", |
|
|
|
|
|
"country": 2 |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
address_str2 = Address.from_json %( |
|
|
|
|
|
{ |
|
|
|
|
|
"name": "String", |
|
|
|
|
|
"address1": "String", |
|
|
|
|
|
"address2": "{type: String, nilable: true}", |
|
|
|
|
|
"postcode": "00002", |
|
|
|
|
|
"city": "String", |
|
|
|
|
|
"country": 2 |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
address_str3 = Address.from_json %( |
|
|
|
|
|
{ |
|
|
|
|
|
"name": "String", |
|
|
|
|
|
"address1": "String", |
|
|
|
|
|
"address2": "{type: String, nilable: true}", |
|
|
|
|
|
"postcode": "00003", |
|
|
|
|
|
"city": "String", |
|
|
|
|
|
"country": 2 |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
(address_str1<=>address_str1).should eq( 0) |
|
|
|
|
|
(address_str3<=>address_str2).should eq(1) |
|
|
|
|
|
(address_str1<=>address_str2).should eq(-1) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
it "can add a user able to log in and out" do |
|
|
it "can add a user able to log in and out" do |
|
|
Dir.mkdir_p Statics.data_path + "user" |
|
|
Dir.mkdir_p Statics.data_path + "user" |
|
|
usr = User.new("dummy@domain.com") |
|
|
usr = User.new("dummy@domain.com") |
|
@ -46,7 +82,7 @@ describe SalesBackend do |
|
|
Global.response.not_nil!.status_code.should eq(200) |
|
|
Global.response.not_nil!.status_code.should eq(200) |
|
|
address_state = Array(Address).from_json(Global.response.not_nil!.body) |
|
|
address_state = Array(Address).from_json(Global.response.not_nil!.body) |
|
|
expected_address_state = Array(Address).from_json(new_address_str) |
|
|
expected_address_state = Array(Address).from_json(new_address_str) |
|
|
(address_state.to_json==expected_address_state.to_json).should be_true |
|
|
|
|
|
|
|
|
(address_state.to_json == expected_address_state.to_json).should be_true |
|
|
get "/user/tokens", headers |
|
|
get "/user/tokens", headers |
|
|
Global.response.not_nil!.status_code.should eq(200) |
|
|
Global.response.not_nil!.status_code.should eq(200) |
|
|
|
|
|
|
|
|