Sha256: eebec401d6260b14148a6a77c9a0224424bef2f4ed20595019c9c3b267d3a4fb

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inkling-0.0.4 spec/models/theme_spec.rb
inkling-0.0.3a spec/models/theme_spec.rb
inkling-0.0.3 spec/models/theme_spec.rb