Sha256: 42ce61b54305211c8b336397d527f5d0cb860f9d0f523244382088d244c77a31

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 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', :gb => 'England'
    end
    output.should == "<ul class=\"f32\"><li class=\"flag ar\" data-cc=\"ar\" data-country=\"Argentina\">Argentina</li><li class=\"flag gb\" data-cc=\"gb\" data-country=\"England\">England</li></ul>"
  end

  it "should list flags" do
    output = flag_title :ar, 'Argentina'
    output.should == "<li class=\"flag ar\" data-cc=\"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\" data-cc=\"ar\" title=\"Argentina\">&nbsp;</li></ul>"
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

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