Sha256: 400d95f3394e2be66514efe51ceef657bba6b24b82a104071f050fd0d1b0854d

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe WorldFlagsHelper do
  include ControllerTestHelpers,
          WorldFlagsHelper

  it "should be empty, with an empty block" do
    output = flags_list do
    end
    output.should == "<ul class=\"f16\"></ul>"
  end

  it "should work with alias :flag_list" do
    output = flag_list do
    end
    output.should == "<ul class=\"f16\"></ul>"
  end

  it "should set size to 16 or 32" do
    lambda do flags_list(8) { }    	
    end.should raise_error
  end

  it "should set size to 16 or 32" do
    output = flags_list 32 do
    end
    output.should == "<ul class=\"f32\"></ul>"
  end

  it "should list flags" do
    output = flags_list 32 do
    	flags :ar => 'Argentina', :en => 'England'
    end
    output.should == "<ul class=\"f32\"><li class=\"flag ar\">Argentina</li><li class=\"flag en\">England</li></ul>"
  end

  it "should list flags" do
    output = flag_title :ar, 'Argentina'
    output.should == "<li class=\"flag ar\" title=\"Argentina\">&nbsp;</li>"
  end

  it "should list flags" do
    output = flags_list 32 do
    	flags_title :ar => 'Argentina'
    end
    output.should == "<ul class=\"f32\"><li class=\"flag ar\" title=\"Argentina\">&nbsp;</li></ul>"
  end

  it "should list flags combined" do
    output = flags_list 32 do
    	[flags(:ar => 'Argentina', :en => 'England'), flag(:br, 'Brazil')].join.html_safe 
    end
    output.should == "<ul class=\"f32\"><li class=\"flag ar\">Argentina</li><li class=\"flag en\">England</li><li class=\"flag br\">Brazil</li></ul>"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
world-flags-0.1.2 spec/world-flags_spec.rb