Skip to content

Instantly share code, notes, and snippets.

@greatseth
Created October 9, 2008 19:38
Show Gist options
  • Select an option

  • Save greatseth/15864 to your computer and use it in GitHub Desktop.

Select an option

Save greatseth/15864 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + "/../../test_helper"
require "action_view/test_case"
class ActionViewHelpersTest < ActionView::TestCase
context "FormHelper extensions" do
setup do
@user = User.new
@form = ActionView::Helpers::FormBuilder.new(:user, @user, self, {}, nil)
end
it "tags text fields with a default class" do
assert_dom_equal \
%{<input class="input_text" type="text" name="user[login]" id="user_login" size="30" />},
@form.text_field(:login)
end
it "tags password fields with a default class" do
assert_dom_equal \
%{<input class="input_password" type="password" name="user[password]" id="user_password" size="30" />},
@form.password_field(:password)
end
end
context "FormTagHelper extensions" do
it "tags text fields with a default class" do
assert_dom_equal \
%{<input class="input_text" type="text" name="login" id="login" />},
text_field_tag(:login)
end
it "tags password fields with a default class" do
assert_dom_equal \
%{<input class="input_password input_text" type="password" name="password" id="password" />},
password_field_tag(:password)
end
it "tags submit buttons with a default class" do
assert_dom_equal \
%{<input class="input_submit" type="submit" value="save" name="commit" />},
submit_tag("save")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment