Sha256: 617694de14282222bfed8d4d7a8fd27d65665f37182c820b9a779bec61576332

Contents?: true

Size: 1.01 KB

Versions: 10

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

10 entries across 10 versions & 1 rubygems

Version Path
formotion-1.3.1 spec/row_type/subform_spec.rb
formotion-1.3 spec/row_type/subform_spec.rb
formotion-1.2 spec/row_type/subform_spec.rb
formotion-1.1.5 spec/row_type/subform_spec.rb
formotion-1.1.4 spec/row_type/subform_spec.rb
formotion-1.1.3 spec/row_type/subform_spec.rb
formotion-1.1.2 spec/row_type/subform_spec.rb
formotion-1.1.1 spec/row_type/subform_spec.rb
formotion-1.1 spec/row_type/subform_spec.rb
formotion-1.0 spec/row_type/subform_spec.rb