Sha256: e24eac2a8513ba594f4636795b460c38e2bc0c2e66ab01e76199df572f9154f0

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

describe "Subform Row" do
  tests_row title: "Subform", type: :subform,
            subform: {
              sections: [{
                rows: [{
                  title: 'Hello',
                  type: :static
                }]
              }]
            }

  it "should build cell with a label and an accessory" do
    cell = @row.make_cell
    cell.accessoryType.should == UITableViewCellAccessoryDisclosureIndicator
    cell.textLabel.text.should == 'Subform'
  end

  it "should build subform" do
    @row.subform.to_form.class.should == Formotion::Form
  end

  it "should push subform on select" do
    form = FakeForm.new
    @row.instance_variable_set("@section", form)

    @row.object._on_select(nil, nil)
    form.controller.push_subform_called.should == true
  end
end


class FakeForm
  def form
    self
  end

  def controller
    @controller ||= FakeControllerClass.new
  end
end

class FakeControllerClass
  attr_accessor :push_subform_called
  def push_subform(form)
    self.push_subform_called = true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
formotion-1.8 spec/row_type/subform_spec.rb
formotion-1.7 spec/row_type/subform_spec.rb
formotion-1.6 spec/row_type/subform_spec.rb
formotion-1.5.1 spec/row_type/subform_spec.rb
formotion-1.5.0 spec/row_type/subform_spec.rb
formotion-1.4.0 spec/row_type/subform_spec.rb