Sha256: b201f9a3b6010288ab72da75b59a3be949c26e2f2bab7d9e30e4378a9b7f7937

Contents?: true

Size: 1.76 KB

Versions: 9

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'

CLASS = RailsAssist::Directory::Container

class Con
  include RailsAssist::Directory
end

class ConExt
  extend RailsAssist::Directory::Container  
end


describe RailsAssist::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

9 entries across 9 versions & 1 rubygems

Version Path
rails_assist-0.5.3 spec/rails_assist/directory/container_spec.rb
rails_assist-0.5.2 spec/rails_assist/directory/container_spec.rb
rails_assist-0.5.1 spec/rails_assist/directory/container_spec.rb
rails_assist-0.5.0 spec/rails_assist/directory/container_spec.rb
rails_assist-0.4.4 spec/rails_assist/directory/container_spec.rb
rails_assist-0.4.3 spec/rails_assist/directory/container_spec.rb
rails_assist-0.4.2 spec/rails_assist/directory/container_spec.rb
rails_assist-0.4.1 spec/rails_assist/directory/container_spec.rb
rails_assist-0.4.0 spec/rails_assist/directory/container_spec.rb