Sha256: 47c06036bca0736f96a5d7ce72ce43764aac166d91cd25d14e3c6ef1f2993c85

Contents?: true

Size: 1.77 KB

Versions: 16

Compression:

Stored size: 1.77 KB

Contents

require 'spec_helper'

CLASS = Rails3::Assist::Directory::Container

class Con
  include Rails3::Assist::Directory
end

class ConExt
  extend Rails3::Assist::Directory::Container  
end


describe Rails3::Assist::Directory::Container do
  # use_helper :directories

  context "using module methods directly" do
    describe '#rails_containers' do
      it "should return symbols list of rails 3 artifact containers" do
        CLASS.rails_containers.should include :controller, :mailer, :helper, :view, :model, :permit
      end
    end

    describe '#valid_container?' do
      it "should return true that since controller is a valid container" do
        CLASS.valid_container?(:controller).should be_true
      end

      it "should return since :unknown is NOT a valid container" do
        CLASS.valid_container?(:unknown).should be_false
      end
    end
  end
  
  context "module included into class" do
    describe '#rails_containers' do
      it "should return symbols list of rails 3 artifact containers" do
        Con.new.rails_containers.should include :controller, :mailer, :helper, :view, :model, :permit
      end
    end

    describe '#valid_container?' do
      it "should return true that since controller is a valid container" do
        Con.new.valid_container?(:controller).should be_true
      end
    end
  end

  context "module extended into class" do
    describe '#rails_containers' do
      it "should return symbols list of rails 3 artifact containers" do
        ConExt.rails_containers.should include :controller, :mailer, :helper, :view, :model, :permit
      end
    end

    describe '#valid_container?' do
      it "should return true that since controller is a valid container" do
        ConExt.valid_container?(:controller).should be_true
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rails3_assist-0.3.7 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.3.6 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.3.5 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.3.4 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.3.3 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.3.2 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.3.1 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.3.0 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.13 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.12 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.11 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.10 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.9 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.8 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.7 spec/rails3_assist/directory/container_spec.rb
rails3_assist-0.2.5 spec/rails3_assist/directory/container_spec.rb