spec/models/resource_spec.rb in alchemy_cms-2.9.1 vs spec/models/resource_spec.rb in alchemy_cms-3.0.0.rc5

- old
+ new

@@ -48,17 +48,10 @@ it "should return the model name (singularized and as a string)" do resource.resource_name.should == "event" end end - describe "#permission_scope" do - it "should set an instance variable that holds the permission scope for declarative authorization" do - resource.permission_scope - resource.instance_variable_get(:@_permission).should == :admin_events - end - end - describe "#namespace_for_scope" do it "should return the namespace" do resource.namespace_for_scope.should == ["admin"] end end @@ -90,17 +83,16 @@ resource.attributes.detect { |a| a[:name] == 'hidden_name' }.should be_nil resource.attributes.detect { |a| a[:name] == 'name' }.should_not be_nil end end - context "when resource_relations defined as class-method in the model" do + context "when alchemy_resource_relations defined as class-method in the model" do before do - ::ActiveSupport::Deprecation.silenced = true Event.class_eval do - def self.resource_relations + def self.alchemy_resource_relations { - :location => {:attr_method => "location#name", :attr_type => :string} + :location => {:attr_method => "name", :attr_type => :string} } end end end @@ -122,21 +114,10 @@ relation = resource.resource_relations[:location_id] relation.keys.should include(:name) relation[:name].should == 'location' end - context "with old hash delimited attr_method style" do - it "should show deprecation warnings" do - ActiveSupport::Deprecation.should_receive(:warn) - resource.resource_relations - end - - it "should return the last part as attr_method" do - resource.resource_relations[:location_id][:attr_method].should == 'name' - end - end - context "#attributes" do it "should contain the relation" do resource.attributes.detect { |a| a[:name] == 'location_id' }.keys.should include(:relation) end @@ -144,13 +125,12 @@ resource.attributes.detect { |a| a[:name] == "location_id" }[:type].should == :string end end after do - ::ActiveSupport::Deprecation.silenced = false Event.class_eval do class << self - undef :resource_relations + undef :alchemy_resource_relations end end end end