Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renaming LiveValidations::Adapter to LiveValidations::AdapterBase. It…

… just makes more sense that way.
  • Loading branch information...
commit 6ec09f9307c4fdc0c2cbed40230dd1e0909e57cb 1 parent 7f898eb
@augustl augustl authored
View
2  lib/live_validations/adapter.rb → lib/live_validations/adapter_base.rb
@@ -1,6 +1,6 @@
module LiveValidations
# The base class of an adapter.
- class Adapter
+ class AdapterBase
attr_reader :data, :active_record_instance, :rendered_attributes
def initialize(active_record_instance)
View
2  ...ve_validations/adapter/validation_hook.rb → ...lidations/adapter_base/validation_hook.rb
@@ -1,5 +1,5 @@
module LiveValidations
- class Adapter
+ class AdapterBase
# The internal representation of each of the 'validates' blocks in the adapter implementation.
class ValidationHook
attr_reader :data, :callback, :prefix, :adapter_instance
View
2  ...alidations/adapter/validation_response.rb → ...tions/adapter_base/validation_response.rb
@@ -1,5 +1,5 @@
module LiveValidations
- class Adapter
+ class AdapterBase
class ValidationResponse
attr_reader :params
def initialize(&block)
View
2  lib/live_validations/adapters/jquery_validations.rb
@@ -1,7 +1,7 @@
module LiveValidations
module Adapters
# Adapter for http://bassistance.de/jquery-plugins/jquery-plugin-validation/
- class JqueryValidations < LiveValidations::Adapter
+ class JqueryValidations < LiveValidations::AdapterBase
setup do |v|
v[:validators] = Hash.new {|hash, key| hash[key] = {} }
v[:messages] = Hash.new {|hash, key| hash[key] = {} }
View
2  lib/live_validations/adapters/livevalidation_dot_com.rb
@@ -1,7 +1,7 @@
module LiveValidations
module Adapters
# Adapter for http://www.livevalidation.com/ (d'oh)
- class LivevalidationDotCom < LiveValidations::Adapter
+ class LivevalidationDotCom < LiveValidations::AdapterBase
setup do |v|
v[:validators] = Hash.new {|hash, key| hash[key] = {} }
end
View
2  lib/live_validations/adapters/validatious.rb
@@ -1,7 +1,7 @@
module LiveValidations
module Adapters
# Adapter for http://www.validatious.org/
- class Validatious < LiveValidations::Adapter
+ class Validatious < LiveValidations::AdapterBase
def alters_tag_attributes?
true
end
View
24 test/general_adapter_test.rb
@@ -5,7 +5,7 @@ def setup
reset_database
reset_callbacks Post
@post = Post.new
- @hook = LiveValidations::Adapter::ValidationHook.new
+ @hook = LiveValidations::AdapterBase::ValidationHook.new
end
def teardown
@@ -32,29 +32,29 @@ def test_message_for_without_custom_message
end
def test_utilizes_inline_javascript_with_data_and_proc
- LiveValidations::Adapter.expects(:setup_proc).returns(Proc.new {})
- LiveValidations::Adapter.expects(:inline_javascript_proc).returns(Proc.new {})
+ LiveValidations::AdapterBase.expects(:setup_proc).returns(Proc.new {})
+ LiveValidations::AdapterBase.expects(:inline_javascript_proc).returns(Proc.new {})
- adapter = LiveValidations::Adapter.new(@post)
+ adapter = LiveValidations::AdapterBase.new(@post)
adapter.expects(:data).returns({:not => "blank"})
assert adapter.utilizes_inline_javascript?
end
def test_utilizes_inline_javascript_with_blank_data_and_proc
- LiveValidations::Adapter.expects(:setup_proc).returns(Proc.new {})
- LiveValidations::Adapter.expects(:inline_javascript_proc).returns(Proc.new {})
+ LiveValidations::AdapterBase.expects(:setup_proc).returns(Proc.new {})
+ LiveValidations::AdapterBase.expects(:inline_javascript_proc).returns(Proc.new {})
- adapter = LiveValidations::Adapter.new(@post)
+ adapter = LiveValidations::AdapterBase.new(@post)
adapter.expects(:data).returns({})
assert !adapter.utilizes_inline_javascript?
end
def test_utilizes_inline_javascript_without_json_proc
- LiveValidations::Adapter.expects(:setup_proc).returns(Proc.new {})
- LiveValidations::Adapter.expects(:inline_javascript_proc).returns(nil)
+ LiveValidations::AdapterBase.expects(:setup_proc).returns(Proc.new {})
+ LiveValidations::AdapterBase.expects(:inline_javascript_proc).returns(nil)
# No point in mocking .json or .data, because it'll never get called anyway.
- adapter = LiveValidations::Adapter.new(@post)
+ adapter = LiveValidations::AdapterBase.new(@post)
assert !adapter.utilizes_inline_javascript?
end
@@ -97,8 +97,8 @@ def test_specifying_invalid_adapter_as_symbol
def test_with_validation_that_has_no_attribute
Post.validate {|r| }
- LiveValidations::Adapter.expects(:setup_proc).returns(Proc.new {})
- adapter = LiveValidations::Adapter.new(@post)
+ LiveValidations::AdapterBase.expects(:setup_proc).returns(Proc.new {})
+ adapter = LiveValidations::AdapterBase.new(@post)
# This test should probably be improved. The plugin used to raise an error when
# the model had attribute-less validations, which is what this tests tries to
Please sign in to comment.
Something went wrong with that request. Please try again.