Sha256: 0144a01e18860792ecb110f12a83228ec6882eff15884443b9031709b3bed3cc

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

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

describe Inkling::Theme do
  
  default = <<-DEFAULT
<html>
<head>
  <title>Inkling Administration</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
</head>
<body>


<div id="header">
	<div id="logo">
		<h1><%= link_to 'Inkling', inkling_user_root_path %></h1>
	</div>
	<div id="tabs">
		<%= link_to 'Home', inkling_user_root_path %> | <%= link_to 'Tree', inkling_paths_path %>
	</div>
</div>

<div class="notice"><%= notice %></div>
<div class="alert"><%= alert %></div>

<div id="page">
  <div id="main">
      <%= yield %> 
  </div>
</div>

<div id="footer">
  <span id="version" align='center'>Inkling version <%= Inkling::VERSION %></span>
</div>


</body>
</html>
  DEFAULT
      
  let(:theme) {Inkling::Theme.create!(:name => "default", :body => default)}
  
  it "should write the theme to the tmp/inkling/themes directory" do
    theme
    lines = []
    file = File.open("tmp/inkling/themes/#{theme.file_name}", "rb")
    contents =  file.read
    
    file_words = contents.split(/\W/)
    theme_words = theme.body.split(/\W/)
    file_words.size.should == theme_words.size

    i = 0
    for word in theme_words
      word.should == file_words[i]
      i += 1
    end
  end
  
  it "should delete the file when the theme model is deleted" do
    theme.destroy
    File.exist?("tmp/inkling/themes/#{theme.file_name}").should be_false  
  end
  
  # describe "installing theme files" do
  #   
  # end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inkling-0.1.0 spec/models/theme_spec.rb
inkling-0.0.9 spec/models/theme_spec.rb
inkling-0.0.8 spec/models/theme_spec.rb
inkling-0.0.7 spec/models/theme_spec.rb
inkling-0.0.5 spec/models/theme_spec.rb