Sha256: ac7f3dfeae382e89baa66c44dd46f609c6bde2abd6ef9db87c0f224d0b306193
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' describe Element do context "scoped" do before(:each) do Element.delete_all end it "should return all public elements" do elements = [Factory(:element, :public => true), Factory(:element, :public => true)] Element.published.all.should == elements end it "should return all elements by name" do elements = [Factory(:element, :name => 'article'), Factory(:element, :name => 'article')] Element.named(['article']).all.should == elements end it "should return all elements but excluded ones" do Factory(:element, :name => 'article') Factory(:element, :name => 'article') excluded = [Factory(:element, :name => 'claim')] Element.excluded(['article']).all.should == excluded end end it "should return a list of element definitions for a list of element names" do element_names = ["article"] definitions = Element.all_definitions_for(element_names) definitions.first.fetch("name").should == 'article' end it "should always return an array calling all_definitions_for()" do definitions = Element.all_definitions_for(nil) definitions.should == [] end it "should raise an error if no descriptions are found" do FileUtils.mv(File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml'), File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml.bak')) expect { Element.descriptions }.should raise_error FileUtils.mv(File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml.bak'), File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', 'elements.yml')) end it "should return an ingredient by name" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alchemy_cms-2.0.rc4 | spec/models/element_spec.rb |