spec/controllers/admin/pages_controller_spec.rb in radiant-0.8.2 vs spec/controllers/admin/pages_controller_spec.rb in radiant-0.9.0.rc2
- old
+ new
@@ -118,11 +118,11 @@
end
end
describe "permissions" do
- [:admin, :developer, :non_admin, :existing].each do |user|
+ [:admin, :designer, :non_admin, :existing].each do |user|
{
:post => :create,
:put => :update,
:delete => :destroy
}.each do |method, action|
@@ -171,18 +171,18 @@
send(:get, action, @parameters.call)
}.should restrict_access(:allow => [users(:admin)],
:url => '/admin/pages')
end
- it "should allow access to developers for the #{action} action" do
+ it "should allow access to designers for the #{action} action" do
lambda {
send(:get, action, @parameters.call)
- }.should restrict_access(:allow => [users(:developer)],
+ }.should restrict_access(:allow => [users(:designer)],
:url => '/admin/pages')
end
- it "should allow non-developers and non-admins for the #{action} action" do
+ it "should allow non-designers and non-admins for the #{action} action" do
lambda {
send(:get, action, @parameters.call)
}.should restrict_access(:allow => [users(:non_admin), users(:existing)],
:url => '/admin/pages')
end
@@ -197,11 +197,11 @@
# TODO: This should be in a view or integration spec
it "should render the expanded descendants of the page being removed" do
get :remove, :id => page_id(:parent), :format => 'html' # shouldn't need this!
rendered_pages = [:parent, :child, :grandchild, :great_grandchild, :child_2, :child_3].map {|p| pages(p) }
rendered_pages.each do |page|
- response.should have_tag("tr#page-#{page.id}")
+ response.should have_tag("tr#page_#{page.id}")
end
end
end
it "should initialize meta and buttons_partials in new action" do
@@ -221,18 +221,37 @@
it "should clear the page cache when saved" do
Radiant::Cache.should_receive(:clear)
put :update, :id => page_id(:home), :page => {:breadcrumb => 'Homepage'}
end
+ describe "@body_classes" do
+ it "should return 'reversed' when the action_name is 'new'" do
+ get :new
+ assigns[:body_classes].should == ['reversed']
+ end
+ it "should return 'reversed' when the action_name is 'edit'" do
+ get :edit, :id => 1
+ assigns[:body_classes].should == ['reversed']
+ end
+ it "should return 'reversed' when the action_name is 'create'" do
+ post :create
+ assigns[:body_classes].should == ['reversed']
+ end
+ it "should return 'reversed' when the action_name is 'update'" do
+ put :update, :id => 1
+ assigns[:body_classes].should == ['reversed']
+ end
+ end
+
protected
def assert_rendered_nodes_where(&block)
wanted, unwanted = Page.find(:all).partition(&block)
wanted.each do |page|
- response.should have_tag("tr#page-#{page.id}")
+ response.should have_tag("tr[id=page_#{page.id}]")
end
unwanted.each do |page|
- response.should_not have_tag("tr#page-#{page.id}")
+ response.should_not have_tag("tr[id=page_#{page.id}]")
end
end
def write_cookie(name, value)
request.cookies[name] = value