Skip to content

Instantly share code, notes, and snippets.

@kylewelsby
Created October 2, 2012 14:46
Show Gist options
  • Save kylewelsby/3819720 to your computer and use it in GitHub Desktop.
Save kylewelsby/3819720 to your computer and use it in GitHub Desktop.
testing a application helper
def active_tab
link_to("Homepage", root_path, :class => ("active" if current_page? root_path))
end
describe "#active_tab" do
it "has a active class" do
helper.stub :current_path? => true
helper.active_tab.should have_selector :a, :class => 'active'
end
end
@jlebrech
Copy link

jlebrech commented Oct 2, 2012

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment