Sha256: c55af2d5859bcc8694cb473d922c94b833c878548b87117420319f4d6f83bb7e

Contents?: true

Size: 1.24 KB

Versions: 14

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

module Alchemy
  describe EssenceText do

    describe '.after_save' do
      let(:essence) { EssenceText.create }

      it "should update the value for `do_not_index`" do
        essence.stub!(:description).and_return({'do_not_index' => true})
        essence.update_attributes(:body => 'hello')
        essence.do_not_index.should be_true
      end

      context "with `do_not_index` set to nil" do
        it "should update the value to false" do
          essence.stub!(:description).and_return({'do_not_index' => nil})
          essence.update_attributes(:body => 'hello')
          essence.do_not_index.should_not be_nil
        end
      end
    end

    context "with `do_not_index` set to true" do
      it "should disable ferret indexing" do
        EssenceText.any_instance.stub(:description).and_return({'do_not_index' => true})
        essence = EssenceText.create!
        essence.ferret_enabled?.should be_false
      end
    end

    context "with `do_not_index` set to false" do
      it "should enable ferret indexing" do
        EssenceText.any_instance.stub(:description).and_return({'do_not_index' => false})
        essence = EssenceText.create
        essence.ferret_enabled?.should be_true
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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