forked from wycats/merb-core
/
base_spec.rb
36 lines (28 loc) · 1.19 KB
/
base_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require File.join(File.dirname(__FILE__), "spec_helper")
describe Merb::Controller, " callable actions" do
before do
Merb.push_path(:layout, File.dirname(__FILE__) / "controllers" / "views" / "layouts")
Merb::Router.prepare do |r|
r.default_routes
end
end
it "should not have any callable actions by default" do
Merb::Controller.callable_actions.should be_empty
end
it "should dispatch to callable actions" do
controller = dispatch_to(Merb::Test::Fixtures::Controllers::Base, :index)
controller.body.should == "index"
controller.status.should == 200
end
it "should not dispatch to hidden actions" do
calling { dispatch_to(Merb::Test::Fixtures::Controllers::Base, :hidden) }.
should raise_error(Merb::ControllerExceptions::ActionNotFound)
end
it "should dispatch to included methods with show_action called" do
dispatch_to(Merb::Test::Fixtures::Controllers::Base, :baz).body.should == "baz"
end
it "should not dispatch to included methods with show_action not called" do
calling { dispatch_to(Merb::Test::Fixtures::Controllers::Base, :bat) }.
should raise_error(Merb::ControllerExceptions::ActionNotFound)
end
end