spec/fixtures/test_client.rb in evil-client-1.1.0 vs spec/fixtures/test_client.rb in evil-client-2.0.0
- old
+ new
@@ -2,12 +2,13 @@
class Client < Evil::Client
option :subdomain
option :user
option :token, optional: true
option :password, optional: true
- validate(:valid_credentials) { token.nil? ^ password.nil? }
+ validate { errors.add :valid_credentials unless token.nil? ^ password.nil? }
+
path { "https://#{subdomain}.example.com" }
response(200)
response(404) { raise "Not found" }
response(500) { raise "Server error" }
@@ -23,10 +24,10 @@
operation :filter do
option :name, optional: true
option :id, optional: true
option :email, optional: true
- validate(:filter_given) { name || id || email }
+ validate { errors.add :filter_given unless name || id || email }
http_method :get
response(200) { |*res| res.last.flat_map { |item| JSON.parse(item) } }
end