Sha256: cd2802636ddb066c282c1ef32e3c478676a69703a2bda9e533264c74b3753ff2

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

require "helper"

module PeopleHelper
  def title(text)
    content_tag(:h1, text)
  end

  def homepage_path
    people_path
  end

  def homepage_url
    people_url
  end

  def link_to_person(person)
    link_to person.name, person
  end
end

# From Rails...
class CrazyHelperTest < ActionView::TestCase
  tests PeopleHelper

  def test_helper_class_can_be_set_manually_not_just_inferred
    assert_equal PeopleHelper, self.class.helper_class
  end
end

class CrazySymbolHelperTest < ActionView::TestCase
  tests :people

  def test_set_helper_class_using_symbol
    assert_equal PeopleHelper, self.class.helper_class
  end
end if Rails::VERSION::STRING >= "3.2"

class CrazyStringHelperTest < ActionView::TestCase
  tests 'people'

  def test_set_helper_class_using_string
    assert_equal PeopleHelper, self.class.helper_class
  end
end if Rails::VERSION::STRING >= "3.2"

# New tests...
describe PeopleHelper do
  it "resolves the right helper_class" do
    assert_equal PeopleHelper, self.class.helper_class
  end
end

describe PeopleHelper, :helper_class do
  it "resolves the right helper_class" do
    assert_equal PeopleHelper, self.class.helper_class
  end
end

describe PeopleHelper do
  describe "even while nested" do
    it "resolves the right helper_class" do
      assert_equal PeopleHelper, self.class.helper_class
    end
  end
end

describe PeopleHelper, :helper_class do
  describe "even while nested" do
    it "resolves the right helper_class" do
      assert_equal PeopleHelper, self.class.helper_class
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
minitest-rails-2.2.1 test/rails/action_view/test_helpers.rb
minitest-rails-2.2.0 test/rails/action_view/test_helpers.rb
minitest-rails-2.1.1 test/rails/action_view/test_helpers.rb
minitest-rails-2.1.0 test/rails/action_view/test_helpers.rb
minitest-rails-2.0.3 test/rails/action_view/test_helpers.rb
minitest-rails-2.0.2 test/rails/action_view/test_helpers.rb
minitest-rails-2.0.1 test/rails/action_view/test_helpers.rb
minitest-rails-2.0.0 test/rails/action_view/test_helpers.rb
minitest-rails-1.0.1 test/rails/action_view/test_helpers.rb
minitest-rails-2.0.0.beta1 test/rails/action_view/test_helpers.rb
minitest-rails-1.0.0 test/rails/action_view/test_helpers.rb
minitest-rails-1.0.0.beta3 test/rails/action_view/test_helpers.rb
minitest-rails-1.0.0.beta2 test/rails/action_view/test_helpers.rb
minitest-rails-1.0.0.beta1 test/rails/action_view/test_helpers.rb
minitest-rails-0.9.2 test/rails/action_view/test_helpers.rb
minitest-rails-0.9.1 test/rails/action_view/test_helpers.rb
minitest-rails-0.9.0 test/rails/action_view/test_helpers.rb
minitest-rails-0.5.2 test/rails/action_view/test_helpers.rb
minitest-rails-0.5.1 test/rails/action_view/test_helpers.rb
minitest-rails-0.5 test/rails/action_view/test_helpers.rb