Sha256: 59ab848ba303a01c326044746c05dd1be296eeff0ed1ece0491c7a9966e5b214

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

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

describe ApplicationHelper do
  
  it 'detects its action' do
    _controller = Object.new
    _controller.stubs(:action_name).returns('index')
    controller.stubs(:controller).returns(_controller)
    controller.action?('index').should be_true
    controller.action?('destroy').should be_false
    controller.action?(/index|show/).should be_true
  end

  it 'formats arrays as HTML lines' do
    controller.array_to_lines([:a, :b, :c]).should == 'a<br />b<br />c'
  end

  it 'returns a check-mark div' do
    controller.checkmark.should == '<div class="checkmark"></div>'
  end

  it 'detects its action' do
    _controller = Object.new
    _controller.stubs(:controller_name).returns('home')
    controller.stubs(:controller).returns(_controller)
    controller.controller?('home').should be_true
    controller.controller?('primary').should be_false
    controller.controller?(/home|primary/).should be_true
 end

  it 'returns an options string with the default select prompt' do
    controller.options_for_array([['1', 'Option 1'], ['2', 'Option 2'], ['3', 'Option 3']]).should == "#{controller.select_prompt_option}<option value=\"1\" >Option 1</option><option value=\"2\" >Option 2</option><option value=\"3\" >Option 3</option>"
  end

  it 'returns an options string with the default select prompt and a default value' do
    controller.options_for_array([['1', 'Option 1'], ['2', 'Option 2'], ['3', 'Option 3']], '2').should == "#{controller.select_prompt_option}<option value=\"1\" >Option 1</option><option value=\"2\" selected=\"1\">Option 2</option><option value=\"3\" >Option 3</option>"
  end

    
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mir_extensions-1.1.0 spec/helpers/application_helper_spec.rb
mir_extensions-1.0.0 spec/helpers/application_helper_spec.rb
mir_extensions-0.2.0 spec/helpers/application_helper_spec.rb