Sha256: 8945977c3d7cd63d38075c234f5311ffd851195961ec160bcf8d40889d858d4f

Contents?: true

Size: 904 Bytes

Versions: 46

Compression:

Stored size: 904 Bytes

Contents

require 'spec_helper'

describe ActiveAdmin::ViewHelpers::FormHelper do
  describe ".hidden_field_tags_for" do
    let(:view) { action_view }

    it "should render hidden field tags for params" do
      view.hidden_field_tags_for(:scope => "All", :filter => "None").should == 
        %{<input id="hidden_active_admin_scope" name="scope" type="hidden" value="All" />\n<input id="hidden_active_admin_filter" name="filter" type="hidden" value="None" />}
    end

    it "should generate not default id for hidden input" do
      view.hidden_field_tags_for(:scope => "All")[/id="([^"]+)"/, 1].should_not == "scope"
    end

    it "should filter out the field passed via the option :except" do
      view.hidden_field_tags_for({:scope => "All", :filter => "None"}, :except => :filter).should == 
        %{<input id="hidden_active_admin_scope" name="scope" type="hidden" value="All" />}
    end
  end
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
lalala-4.0.0.dev.59 vendor/deps/active_admin/spec/unit/view_helpers/form_helper_spec.rb
lalala-4.0.0.dev.58 vendor/deps/active_admin/spec/unit/view_helpers/form_helper_spec.rb
lalala-4.0.0.dev.57 vendor/deps/active_admin/spec/unit/view_helpers/form_helper_spec.rb
lalala-4.0.0.dev.56 vendor/deps/active_admin/spec/unit/view_helpers/form_helper_spec.rb
lalala-4.0.0.dev.50 vendor/deps/active_admin/spec/unit/view_helpers/form_helper_spec.rb
lalala-4.0.0.dev.46 vendor/deps/active_admin/spec/unit/view_helpers/form_helper_spec.rb