lib/interpol/stub_app.rb in interpol-0.4.1 vs lib/interpol/stub_app.rb in interpol-0.4.2
- old
+ new
@@ -26,10 +26,11 @@
set :stub_app_builder, builder
not_found { JSON.dump(:error => "The requested resource could not be found") }
before { content_type "application/json;charset=utf-8" }
before('/__ping') { skip_param_parsing! if respond_to?(:skip_param_parsing!) }
get('/__ping') { JSON.dump(:message => "Interpol stub app running.") }
+ enable :perform_validations
def self.name
"Interpol::StubApp (anonymous)"
end
end
@@ -44,10 +45,10 @@
def endpoint_definition(endpoint)
lambda do
example, version = settings.
stub_app_builder.
example_and_version_for(endpoint, self)
- example.validate!
+ example.validate! if settings.perform_validations?
status endpoint.find_example_status_code_for!(version)
JSON.dump(example.data)
end
end