Sha256: 8c21998da89f9d3b15194df52506266e88f6f6f1a719508e2fb9941e20e3bd00

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require "spec_helper"

describe NestedForm::ViewHelper do
  before(:each) do
    @template = ActionView::Base.new
    @template.output_buffer = ""
    @template.stubs(:url_for).returns("")
    @template.stubs(:projects_path).returns("")
    @template.stubs(:protect_against_forgery?).returns(false)
  end

  it "should pass nested form builder to form_for along with other options" do
    pending
    mock.proxy(@template).form_for(:first, :as => :second, :other => :arg, :builder => NestedForm::Builder) do |form_html|
      form_html
    end
    @template.nested_form_for(:first, :as => :second, :other => :arg) {"form"}
  end

  it "should pass instance of NestedForm::Builder to nested_form_for block" do
    @template.nested_form_for(Project.new) do |f|
      f.should be_instance_of(NestedForm::Builder)
    end
  end

  it "should append content to end of nested form" do
    @template.after_nested_form(:tasks) { @template.concat("123") }
    @template.after_nested_form(:milestones) { @template.concat("456") }
    @template.nested_form_for(Project.new) {}
    @template.output_buffer.should include("123456")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nested_form-0.1.1 spec/nested_form/view_helper_spec.rb
nested_form-0.1.0 spec/nested_form/view_helper_spec.rb
nested_form-0.0.0 spec/nested_form/view_helper_spec.rb