Sha256: a3835ced574bb08d07bb3b98db4d4d30382de9709303350889afd4807ecd732a

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe 'Given a new test theme' do
  before(:each) do
    @theme = Theme.new("test", "test")
  end

  it 'layout path should be "#{RAILS_ROOT}/themes/test/layouts/default.html.erb"'  do
    @theme.layout('index').should == "#{RAILS_ROOT}/themes/test/layouts/default.html.erb"
  end  
end

describe 'Given the default theme' do
  before(:each) do
    @theme = Blog.default.current_theme
  end

  it 'theme should be typographic' do
    @theme.name.should == 'typographic'
  end

  it 'theme description should be correct' do
    @theme.description.should ==
      File.open(RAILS_ROOT + '/themes/typographic/about.markdown') {|f| f.read}
  end

  it 'theme_from_path should find the correct theme' do
    Theme.theme_from_path(RAILS_ROOT + 'themes/typographic').name.should == 'typographic'
    Theme.theme_from_path(RAILS_ROOT + 'themes/scribbish').name.should == 'scribbish'
  end

  it '#search_theme_path finds the right things' do
    Theme.should_receive(:themes_root).and_return(RAILS_ROOT + '/test/mocks/themes')
    Theme.search_theme_directory.collect{|t| File.basename(t)}.sort.should ==
      %w{ 123-numbers-in-path CamelCaseDirectory i-have-special-chars typographic }
  end

  it 'find_all finds all the installed themes' do
    Theme.find_all.collect{|t| t.name}.should include(@theme.name)
    Theme.find_all.size.should ==
      Dir.glob(RAILS_ROOT + '/themes/[a-zA-Z0-9]*').select do |file|
        File.readable? "#{file}/about.markdown"
      end.size
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
typo-5.4.4 spec/models/theme_spec.rb
typo-5.4.3 spec/models/theme_spec.rb
typo-5.4.2 spec/models/theme_spec.rb
typo-5.4.1 spec/models/theme_spec.rb
typo-5.4 spec/models/theme_spec.rb