Sha256: 4e43f3e7593886d526a11690c4294bcc30ef6468de65d8ed85b3713fc88966fd

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'lrd_view_helper'

describe LRD::ViewHelper do
  
  describe "bool_checked" do
    describe "with true" do
      it "should return an image tag for the checkmark" do
        helper.bool_checked(true).should =~ /images\/check.png/
      end
    end
    describe "with false" do
      it "should return an image tag for a spacer" do
        helper.bool_checked(false).should =~ /images\/blank.gif/        
      end
    end
  end   
                 
  describe "labeled_input" do
    before(:each) do
      @form = mock(ActionView::Helpers::FormHelper)
      @form.stub!(:text_field).and_return("<input name='field' />")
      @form.stub!(:label).and_return("<label for='field'>")
      
      @labeled_input = helper.labeled_input(@form, :field)
    end
    
    it "should return a string" do  
      @labeled_input.is_a?(String).should be_true
    end
    it "should contain the input tag" do
      @labeled_input.should match(/<input/)
      @labeled_input.should match(/name='field'/)
    end               
    it "should contain the label tag field" do
      @labeled_input.should match(/<label/)
      @labeled_input.should match(/for='field'/)
    end
    
  end                 
                 
   
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lrd_view_tools-0.1.1 spec/helpers/lrd_view_helper_spec.rb
lrd_view_tools-0.1.0 spec/helpers/lrd_view_helper_spec.rb