Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

verify value is taken from object

  • Loading branch information...
commit 6edfbfb01786c389c1678d6fcfbb6e075f9e18ce 1 parent 3fb5147
@twalpole twalpole authored committed
View
2  lib/formtastic/inputs/hidden_input.rb
@@ -36,7 +36,7 @@ class HiddenInput
#
# @todo this is inconsistent with all other inputs, deprecate and remove
def input_html_options
- {:value => options[:value]}.merge(super).merge(:required => nil)
+ options.slice(:value).merge(super).merge(:required => nil)
end
def to_html
View
4 spec/inputs/hidden_input_spec.rb
@@ -28,6 +28,10 @@
output_buffer.should have_tag("form li input#post_secret[@name=\"post[secret]\"]")
end
+ it "should get value from the object" do
+ output_buffer.should have_tag("form li input#post_secret[@type=\"hidden\"][@value=\"1\"]")
+ end
+
it "should pass any explicitly specified value - using :value" do
output_buffer.should have_tag("form li input#post_author_id[@type=\"hidden\"][@value=\"99\"]")
end
View
4 spec/spec_helper.rb
@@ -181,7 +181,7 @@ def new_author_path; "/authors/new"; end
@new_post.stub!(:to_key).and_return(nil)
@new_post.stub!(:to_model).and_return(@new_post)
@new_post.stub!(:persisted?).and_return(nil)
-
+
@freds_post = mock('post')
@freds_post.stub!(:to_ary)
@freds_post.stub!(:class).and_return(::Post)
@@ -248,7 +248,7 @@ def new_author_path; "/authors/new"; end
@new_post.stub!(:published)
@new_post.stub!(:publish_at)
@new_post.stub!(:created_at)
- @new_post.stub!(:secret)
+ @new_post.stub!(:secret).and_return(1)
@new_post.stub!(:url)
@new_post.stub!(:email)
@new_post.stub!(:search)
Please sign in to comment.
Something went wrong with that request. Please try again.