Sha256: d94b34255dcb63220e1552b1e715b5d426c317893d0d4f617a56241f241b10f6

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Manageable::ApplicationHelper, "displaying icons" do
  it "returns an empty string when called with nil" do
    helper.manageable_icon(nil).should eq("")
  end

  it "creates an image tag containing the appropriate icon when called" do
    helper.should_receive(:image_tag).with("/assets/manageable/icons/16x16/add.png", instance_of(Hash))
    helper.manageable_icon("add")
  end

  it "creates the icon at 16x16 when size is small" do
    helper.should_receive(:image_tag).with("/assets/manageable/icons/16x16/add.png", instance_of(Hash))
    helper.manageable_icon("add", :small)
  end

  it "creates the icon at 32x32 when size is small" do
    helper.should_receive(:image_tag).with("/assets/manageable/icons/32x32/add.png", instance_of(Hash))
    helper.manageable_icon("add", :large)
  end

  it "sets the alt attribute to the icon name by default" do
    helper.should_receive(:image_tag).with(duck_type(:to_s), {
      :alt => "Add"
    })
    helper.manageable_icon("add", :small)
  end

  it "sets the alt attribute to the provided value if provided" do
    helper.should_receive(:image_tag).with(duck_type(:to_s), {
      :alt => "An icon"
    })
    helper.manageable_icon("add", :small, :alt => "An icon")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
manageable-0.1.4 spec/helpers/icon_spec.rb
manageable-0.1.3 spec/helpers/icon_spec.rb
manageable-0.1.2 spec/helpers/icon_spec.rb
manageable-0.1.1 spec/helpers/icon_spec.rb