Sha256: ea909847211b3c1b7788e8de48596ddbe57c57fbf86e3e9de95ae12e727694a4

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

describe Formic::ListItems do
  before(:each) do
    @model = Object.new
    stub(@page).render

    @options = {}
    @block = Proc.new {}
  end

  context "#initialize" do
    before(:each) do
      @list_items = Formic::ListItems.new @page
      @list_items.style ['Item 1', 'Item 2'], @options, &@block
    end

    it "should have template formic/default/list_items" do
      @list_items.template.should == 'formic/default/list_items'
    end

    it "it should have a list of items with same style, options" do
      @list_items.first.text.should == 'Item 1'
      @list_items.first.options.should == @options.merge(:class => ['list_item', 'style'])

      @list_items.last.text.should == 'Item 2'
      @list_items.last.options.should == @options.merge(:class => ['list_item', 'style'])
    end

    it "should have the block" do
      @list_items.content.should == @block
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formic-0.2.5 spec/formic/list_items_spec.rb
formic-0.2.1 spec/formic/list_items_spec.rb