1 require File.dirname(__FILE__) + '/../../spec_helper'
2 Spec::Runner.configuration.global_fixtures = :people
4 describe "HelperBehaviour", :behaviour_type => :helper do
7 it "should have direct access to methods defined in helpers" do
8 method_in_explicit_helper.should =~ /text from a method/
13 describe "HelperBehaviour#eval_erb", :behaviour_type => :helper do
16 it "should support methods that accept blocks" do
17 eval_erb("<% prepend 'foo' do %>bar<% end %>").should == "foobar"
21 describe "HelperBehaviour.fixtures", :behaviour_type => :helper do
25 it "loads fixtures" do
27 pig.class.should == Animal
30 it "loads global fixtures" do
31 lachie = people(:lachie)
32 lachie.class.should == Person
36 describe ExplicitHelper, :behaviour_type => :helper do
37 it "should not require naming the helper if describe is passed a type" do
38 method_in_explicit_helper.should match(/text from a method/)
45 describe HelperBehaviour do
46 it "should tell you its behaviour_type is :helper" do
47 behaviour = HelperBehaviour.new("") {}
48 behaviour.behaviour_type.should == :helper
56 # see http://rubyforge.org/tracker/index.php?func=detail&aid=11223&group_id=797&atid=3149
57 describe 'Accessing flash from helper spec', :behaviour_type => :helper do
58 it 'should not raise an error' do
59 lambda { flash['test'] }.should_not raise_error