Sha256: d8962fedeeb97cfb621cddabf1b0b4e33e51204b6ca89750e3e8acb28047dcde

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe BooleanComponent do

  include RSpec::Rails::RequestExampleGroup

  context 'index' do
    it 'should render checkbox' do
      @category = Fabricate :category
      get admin_categories_path

      field = controller.index_fields[:hidden]
      component = Puffer::Component::Base.render_component(controller, field, :index, :record => @category)

      p component
    end
  end

  context 'form' do
    it 'should render form field' do
      @category = Fabricate :category
      get admin_categories_path

      field = controller.form_fields[:hidden]
      component = ''
      controller.view_context.form_for @category, :url => admin_category_path(@category) do |form|
        component = Puffer::Component::Base.render_component(controller, field, :form, :form => form)
      end

      component.should have_selector("input[type=hidden][value='0']")
      component.should have_selector("input[type=checkbox][value='1']")
      component.should have_selector('label[for=category_hidden]')
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puffer-0.0.32 spec/app/components/boolean_component_spec.rb
puffer-0.0.31 spec/app/components/boolean_component_spec.rb
puffer-0.0.30 spec/app/components/boolean_component_spec.rb
puffer-0.0.29 spec/app/components/boolean_component_spec.rb
puffer-0.0.28 spec/app/components/boolean_component_spec.rb
puffer-0.0.26 spec/app/components/boolean_component_spec.rb
puffer-0.0.25 spec/app/components/boolean_component_spec.rb
puffer-0.0.24 spec/app/components/boolean_component_spec.rb