Sha256: f76699abb3ea1f968f92434781299826379bda1265bb0a85ff54c09b281b0d3d

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

module Alchemy
  describe Cell do

    let(:cell) { FactoryGirl.build(:cell) }

    describe "#available_elements" do

      context "without assigned elements" do
        it "should return an empty Array" do
          cell.stub!(:description).and_return({})
          cell.available_elements.should == []
        end
      end

      context "with assigned elements" do
        it "should return an Array of element names" do
          cell.stub!(:description).and_return({'elements' => ['test_element', 'test_element_2']})
          cell.available_elements.should == ['test_element', 'test_element_2']
        end
      end

    end

    describe "#description" do

      context "without a definition for the expected cellname" do
        it "should return an empty Hash" do
          Cell.stub!(:definition_for).and_return({})
          cell.description.should == {}
        end
      end

      context "with a definition for the expected cellname found" do
        it "should return its definition Hash" do
          Cell.stub!(:definition_for).and_return({'name' => 'test_cell', 'elements' => ['test_element', 'test_element_2']})
          cell.description.should == {'name' => 'test_cell', 'elements' => ['test_element', 'test_element_2']}
        end
      end

    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
alchemy_cms-2.6.3 spec/models/cell_spec.rb
alchemy_cms-2.6.2.1 spec/models/cell_spec.rb
alchemy_cms-2.6.2 spec/models/cell_spec.rb
alchemy_cms-2.6.1 spec/models/cell_spec.rb
alchemy_cms-2.6.0 spec/models/cell_spec.rb
alchemy_cms-2.6.0.rc5 spec/models/cell_spec.rb
alchemy_cms-2.5.3.1 spec/models/cell_spec.rb
alchemy_cms-2.5.3 spec/models/cell_spec.rb
alchemy_cms-2.5.2.2 spec/models/cell_spec.rb
alchemy_cms-2.5.2.1 spec/models/cell_spec.rb
alchemy_cms-2.5.2 spec/models/cell_spec.rb
alchemy_cms-2.5.1 spec/models/cell_spec.rb
alchemy_cms-2.5.0 spec/models/cell_spec.rb
alchemy_cms-2.5.0.rc3 spec/models/cell_spec.rb
alchemy_cms-2.5.0.b9 spec/models/cell_spec.rb