Skip to content
Browse files

Add features, fix bugs

  • Loading branch information...
1 parent a219e12 commit 74df7c332be29ac59e9b85d88b12506fa3255022 @dolzenko committed
Showing with 6,836 additions and 15 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 Gemfile
  3. +25 −1 app/controllers/application_controller.rb
  4. +1 −1 app/controllers/articles_controller.rb
  5. +6 −0 app/helpers/articles_helper.rb
  6. +2 −0 app/models/article.rb
  7. +10 −1 app/stylesheets/screen.sass
  8. +7 −0 app/views/articles/_article.html.haml
  9. +1 −7 app/views/articles/index.html.haml
  10. +5 −2 app/views/layouts/articles.html.haml
  11. +15 −0 config/initializers/relative_assets_paths.rb
  12. +2 −1 config/routes.rb
  13. +11 −0 db/migrate/20100323142951_add_parent_id_and_order_to_article.rb
  14. +7 −0 db/migrate/20100323145036_test_migration.rb
  15. +7 −0 db/migrate/20100323150701_test3.rb
  16. +17 −0 db/models/articles/48-annotatsiya/content.html.erb
  17. 0 db/models/articles/49-dopolnitelnye-materialy/content.html.erb
  18. 0 db/models/articles/50-dopolnitelnye-materialy/content.html.erb
  19. 0 db/models/articles/51-dopolnitelnye-materialy/content.html.erb
  20. 0 db/models/articles/52-dopolnitelnye-materialy/content.html.erb
  21. +3 −1 db/schema.rb
  22. +54 −0 lib/static_builder.rb
  23. +5 −0 public/javascripts/application.js
  24. +6,286 −0 public/javascripts/jquery.js
  25. +26 −0 vendor/plugins/acts_as_tree/README
  26. +22 −0 vendor/plugins/acts_as_tree/Rakefile
  27. +1 −0 vendor/plugins/acts_as_tree/init.rb
  28. +96 −0 vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
  29. 0 vendor/plugins/acts_as_tree/test/abstract_unit.rb
  30. +219 −0 vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb
  31. 0 vendor/plugins/acts_as_tree/test/database.yml
  32. 0 vendor/plugins/acts_as_tree/test/fixtures/mixin.rb
  33. 0 vendor/plugins/acts_as_tree/test/fixtures/mixins.yml
  34. 0 vendor/plugins/acts_as_tree/test/schema.rb
  35. +3 −1 vendor/plugins/haml/init.rb
View
1 .gitignore
@@ -3,4 +3,5 @@ db/*.sqlite3
log/*.log
tmp/**/*
misc/
+build/
.idea/
View
4 Gemfile
@@ -6,3 +6,7 @@ gem 'mysql'
gem 'haml-edge'
gem 'mongrel'
gem "compass", "0.10.0.rc1"
+
+group :development do
+ gem "ruby-debug19"
+end
View
26 app/controllers/application_controller.rb
@@ -1,7 +1,31 @@
class ApplicationController < ActionController::Base
- protect_from_forgery
+ if Rails.env.production?
+ def self.caches_all_pages(*actions)
+ return unless perform_caching
+ options = actions.extract_options!
+ after_filter(options) do |c|
+ c.expire_page
+ c.cache_page
+ end
+ end
+ caches_all_pages
+ end
+
def default_url_options
{ :format => :html }
end
+
+ def url_for(options)
+ url = super(options)
+ if url =~ /^http/
+ url
+ else
+ relative_to_request(url)
+ end
+ end
+
+ def relative_to_request(absolute_path)
+ Pathname.new(absolute_path).relative_path_from(Pathname.new(File.dirname(request.path))).to_s
+ end
end
View
2 app/controllers/articles_controller.rb
@@ -2,7 +2,7 @@ class ArticlesController < ApplicationController
# GET /articles
# GET /articles.xml
def index
- @articles = Article.all
+ @articles = Article.roots
respond_to do |format|
format.html # index.html.erb
View
6 app/helpers/articles_helper.rb
@@ -6,4 +6,10 @@ def article_asset_path(path)
def article_image_tag(source, options = {})
image_tag(article_asset_path(source), options)
end
+
+ def parent_select_choices
+ choices = []
+
+ Article.root
+ end
end
View
2 app/models/article.rb
@@ -7,6 +7,8 @@ class Article < ActiveRecord::Base
before_save :sync_filesystem_attrs
after_create :init_filesystem_attrs
validate :title => :presence
+
+ acts_as_tree :order => :position
def content
if file = filesystem_attr_file
View
11 app/stylesheets/screen.sass
@@ -45,6 +45,10 @@ body.three-col
@import compass/utilities.sass
+.module
+ margin:
+ left: 2em
+
.article
font:
family: Times New Roman
@@ -88,4 +92,9 @@ body.three-col
.attention
font:
weight: bold
- style: italic
+ style: italic
+
+
+.articles.index
+ .controls
+ display: none
View
7 app/views/articles/_article.html.haml
@@ -0,0 +1,7 @@
+.item.section
+ = link_to article.title, article
+ - if Rails.env.development?
+ .controls
+ = link_to 'Edit', edit_article_path(article)
+ = link_to 'Destroy', article, :confirm => 'Are you sure?', :method => :delete
+ .item.module= render article.children
View
8 app/views/articles/index.html.haml
@@ -1,10 +1,4 @@
-- for article in @articles
- %div= link_to article.title, article
- - if Rails.env.development?
- = link_to 'Edit', edit_article_path(article)
- = link_to 'Destroy', article, :confirm => 'Are you sure?', :method => :delete
- %br
- %br
+!= render @articles
- if Rails.env.development?
= link_to 'New article', new_article_path
View
7 app/views/layouts/articles.html.haml
@@ -1,12 +1,15 @@
!!!
-%html
+%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "ru", :lang => "ru"}
%head
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=UTF-8'}
%title== Articles: #{ controller.action_name }
= stylesheet_link_tag 'compiled/screen.css', :media => 'screen, projection'
+ = javascript_include_tag %w(jquery application)
= csrf_meta_tag
%body.bp
-if notice.present?
%p.notice= notice
- = yield
+ %div{:class => page_class}
+ = yield
View
15 config/initializers/relative_assets_paths.rb
@@ -0,0 +1,15 @@
+module RelativeAssetsPaths
+ private
+
+ def rewrite_asset_path(source)
+ relative_to_request(source)
+ end
+
+ def relative_to_request(absolute_path)
+ Pathname.new(absolute_path).relative_path_from(Pathname.new(File.dirname(request.path))).to_s
+ end
+end
+
+ActionView::Base.class_eval do
+ include RelativeAssetsPaths
+end
View
3 config/routes.rb
@@ -50,7 +50,8 @@
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
- # root :to => "welcome#index"
+ # root :to => "articles#index"
+ match "index.:format" => "articles#index"
# See how all your routes lay out with "rake routes"
View
11 db/migrate/20100323142951_add_parent_id_and_order_to_article.rb
@@ -0,0 +1,11 @@
+class AddParentIdAndOrderToArticle < ActiveRecord::Migration
+ def self.up
+ change_table :articles do |t|
+ t.belongs_to :parent
+ t.integer :position, :default => 0
+ end
+ end
+
+ def self.down
+ end
+end
View
7 db/migrate/20100323145036_test_migration.rb
@@ -0,0 +1,7 @@
+class TestMigration < ActiveRecord::Migration
+ def self.up
+ end
+
+ def self.down
+ end
+end
View
7 db/migrate/20100323150701_test3.rb
@@ -0,0 +1,7 @@
+class Test3 < ActiveRecord::Migration
+ def self.up
+ end
+
+ def self.down
+ end
+end
View
17 db/models/articles/48-annotatsiya/content.html.erb
@@ -0,0 +1,17 @@
+<div>Электронное учебное пособие «Развитие научных исследований туристской деятельности в России: 1930 - 2010 гг.»
+ представляет собой обязательный литературный источник новой учебной дисциплины «История и методология туризмоведения»,
+ включенной в 2010 г. в учебный план специальности 100 201 «Туризм» на геолого-географическом факультете Южного
+ федерального университета.
+</div>
+<div>Впервые в отечественной литературе, как научного, так и учебного характера, в пособии представлено развитие научных
+ исследований в области туризма в СССР и Российской Федерации за 80 лет, начиная с первых работ Центрального
+ государственного института курортологии по изучению физиологии туристских путешествий с активными средствами
+ передвижения.
+</div>
+<div>Авторы рассматривают как происходило развитие в изучении экономических и исторических аспектов туризма, становление
+ и эволюцию рекреационной географии, современные прикладные научно-исследовательские направления работ в целях
+ дальнейшего совершенствования российской индустрии туризма.
+</div>
+<div>Учебное пособие может быть использовано как студентами, обучающимися по специальности «Туризм», так и по
+ специальности «Социально-культурный сервис и туризм» при изучении дисциплин «Основы туризма» и «История туризма».
+</div>
View
0 db/models/articles/49-dopolnitelnye-materialy/content.html.erb
No changes.
View
0 db/models/articles/50-dopolnitelnye-materialy/content.html.erb
No changes.
View
0 db/models/articles/51-dopolnitelnye-materialy/content.html.erb
No changes.
View
0 db/models/articles/52-dopolnitelnye-materialy/content.html.erb
No changes.
View
4 db/schema.rb
@@ -9,13 +9,15 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20100322103740) do
+ActiveRecord::Schema.define(:version => 20100323150701) do
create_table "articles", :force => true do |t|
t.string "title"
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
+ t.integer "parent_id"
+ t.integer "position", :default => 0
end
end
View
54 lib/static_builder.rb
@@ -0,0 +1,54 @@
+require "fileutils"
+require "rails/console/app"
+
+class StaticBuilder
+ include Rails.application.routes.url_helpers
+
+ def self.build
+ ActionController::Base.page_cache_directory = "build" # ???
+ new.build
+ end
+
+ def build
+ purge_build_dir
+
+ cache_paths
+
+ copy_public
+
+ cleanup_unused
+ end
+
+ def build_dir
+ Rails.root + "build"
+ end
+
+ def cache_paths
+ paths = []
+ paths << "/index"
+ paths << "/articles"
+ paths += Article.all.map { |a| article_path(a) }
+ paths.each(&method(:get))
+ end
+
+ def purge_build_dir
+ puts "Purging #{ build_dir }"
+ FileUtils.rm_rf(Dir[build_dir])
+ end
+
+ def get(path)
+ p = "#{ path }.html"
+ puts "Caching #{ p }"
+ app.get p
+ end
+
+ def copy_public
+ puts "Copying public/ dir to build/"
+ FileUtils.cp_r(Rails.root + "public/.", build_dir)
+ end
+
+ def cleanup_unused
+ FileUtils.rm build_dir + ".gitignore"
+ FileUtils.rm Dir[build_dir + "**/*.erb"]
+ end
+end
View
5 public/javascripts/application.js
@@ -0,0 +1,5 @@
+$(function() {
+ $(".articles.index .item").hover(function() {
+ $(this).find(".controls:first").toggle();
+ });
+});
View
6,286 public/javascripts/jquery.js
6,286 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
26 vendor/plugins/acts_as_tree/README
@@ -0,0 +1,26 @@
+acts_as_tree
+============
+
+Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children
+association. This requires that you have a foreign key column, which by default is called +parent_id+.
+
+ class Category < ActiveRecord::Base
+ acts_as_tree :order => "name"
+ end
+
+ Example:
+ root
+ \_ child1
+ \_ subchild1
+ \_ subchild2
+
+ root = Category.create("name" => "root")
+ child1 = root.children.create("name" => "child1")
+ subchild1 = child1.children.create("name" => "subchild1")
+
+ root.parent # => nil
+ child1.parent # => root
+ root.children # => [child1]
+ root.children.first.children.first # => subchild1
+
+Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
View
22 vendor/plugins/acts_as_tree/Rakefile
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test acts_as_tree plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for acts_as_tree plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'acts_as_tree'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
1 vendor/plugins/acts_as_tree/init.rb
@@ -0,0 +1 @@
+ActiveRecord::Base.send :include, ActiveRecord::Acts::Tree
View
96 vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb
@@ -0,0 +1,96 @@
+module ActiveRecord
+ module Acts
+ module Tree
+ def self.included(base)
+ base.extend(ClassMethods)
+ end
+
+ # Specify this +acts_as+ extension if you want to model a tree structure by providing a parent association and a children
+ # association. This requires that you have a foreign key column, which by default is called +parent_id+.
+ #
+ # class Category < ActiveRecord::Base
+ # acts_as_tree :order => "name"
+ # end
+ #
+ # Example:
+ # root
+ # \_ child1
+ # \_ subchild1
+ # \_ subchild2
+ #
+ # root = Category.create("name" => "root")
+ # child1 = root.children.create("name" => "child1")
+ # subchild1 = child1.children.create("name" => "subchild1")
+ #
+ # root.parent # => nil
+ # child1.parent # => root
+ # root.children # => [child1]
+ # root.children.first.children.first # => subchild1
+ #
+ # In addition to the parent and children associations, the following instance methods are added to the class
+ # after calling <tt>acts_as_tree</tt>:
+ # * <tt>siblings</tt> - Returns all the children of the parent, excluding the current node (<tt>[subchild2]</tt> when called on <tt>subchild1</tt>)
+ # * <tt>self_and_siblings</tt> - Returns all the children of the parent, including the current node (<tt>[subchild1, subchild2]</tt> when called on <tt>subchild1</tt>)
+ # * <tt>ancestors</tt> - Returns all the ancestors of the current node (<tt>[child1, root]</tt> when called on <tt>subchild2</tt>)
+ # * <tt>root</tt> - Returns the root of the current node (<tt>root</tt> when called on <tt>subchild2</tt>)
+ module ClassMethods
+ # Configuration options are:
+ #
+ # * <tt>foreign_key</tt> - specifies the column name to use for tracking of the tree (default: +parent_id+)
+ # * <tt>order</tt> - makes it possible to sort the children according to this SQL snippet.
+ # * <tt>counter_cache</tt> - keeps a count in a +children_count+ column if set to +true+ (default: +false+).
+ def acts_as_tree(options = {})
+ configuration = { :foreign_key => "parent_id", :order => nil, :counter_cache => nil }
+ configuration.update(options) if options.is_a?(Hash)
+
+ belongs_to :parent, :class_name => name, :foreign_key => configuration[:foreign_key], :counter_cache => configuration[:counter_cache]
+ has_many :children, :class_name => name, :foreign_key => configuration[:foreign_key], :order => configuration[:order], :dependent => :destroy
+
+ class_eval <<-EOV
+ include ActiveRecord::Acts::Tree::InstanceMethods
+
+ def self.roots
+ find(:all, :conditions => "#{configuration[:foreign_key]} IS NULL", :order => #{configuration[:order].nil? ? "nil" : %Q{"#{configuration[:order]}"}})
+ end
+
+ def self.root
+ find(:first, :conditions => "#{configuration[:foreign_key]} IS NULL", :order => #{configuration[:order].nil? ? "nil" : %Q{"#{configuration[:order]}"}})
+ end
+ EOV
+ end
+ end
+
+ module InstanceMethods
+ # Returns list of ancestors, starting from parent until root.
+ #
+ # subchild1.ancestors # => [child1, root]
+ def ancestors
+ node, nodes = self, []
+ nodes << node = node.parent while node.parent
+ nodes
+ end
+
+ # Returns the root node of the tree.
+ def root
+ node = self
+ node = node.parent while node.parent
+ node
+ end
+
+ # Returns all siblings of the current node.
+ #
+ # subchild1.siblings # => [subchild2]
+ def siblings
+ self_and_siblings - [self]
+ end
+
+ # Returns all siblings and a reference to the current node.
+ #
+ # subchild1.self_and_siblings # => [subchild1, subchild2]
+ def self_and_siblings
+ parent ? parent.children : self.class.roots
+ end
+ end
+ end
+ end
+end
View
0 vendor/plugins/acts_as_tree/test/abstract_unit.rb
No changes.
View
219 vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb
@@ -0,0 +1,219 @@
+require 'test/unit'
+
+require 'rubygems'
+require 'active_record'
+
+$:.unshift File.dirname(__FILE__) + '/../lib'
+require File.dirname(__FILE__) + '/../init'
+
+class Test::Unit::TestCase
+ def assert_queries(num = 1)
+ $query_count = 0
+ yield
+ ensure
+ assert_equal num, $query_count, "#{$query_count} instead of #{num} queries were executed."
+ end
+
+ def assert_no_queries(&block)
+ assert_queries(0, &block)
+ end
+end
+
+ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
+
+# AR keeps printing annoying schema statements
+$stdout = StringIO.new
+
+def setup_db
+ ActiveRecord::Base.logger
+ ActiveRecord::Schema.define(:version => 1) do
+ create_table :mixins do |t|
+ t.column :type, :string
+ t.column :parent_id, :integer
+ end
+ end
+end
+
+def teardown_db
+ ActiveRecord::Base.connection.tables.each do |table|
+ ActiveRecord::Base.connection.drop_table(table)
+ end
+end
+
+class Mixin < ActiveRecord::Base
+end
+
+class TreeMixin < Mixin
+ acts_as_tree :foreign_key => "parent_id", :order => "id"
+end
+
+class TreeMixinWithoutOrder < Mixin
+ acts_as_tree :foreign_key => "parent_id"
+end
+
+class RecursivelyCascadedTreeMixin < Mixin
+ acts_as_tree :foreign_key => "parent_id"
+ has_one :first_child, :class_name => 'RecursivelyCascadedTreeMixin', :foreign_key => :parent_id
+end
+
+class TreeTest < Test::Unit::TestCase
+
+ def setup
+ setup_db
+ @root1 = TreeMixin.create!
+ @root_child1 = TreeMixin.create! :parent_id => @root1.id
+ @child1_child = TreeMixin.create! :parent_id => @root_child1.id
+ @root_child2 = TreeMixin.create! :parent_id => @root1.id
+ @root2 = TreeMixin.create!
+ @root3 = TreeMixin.create!
+ end
+
+ def teardown
+ teardown_db
+ end
+
+ def test_children
+ assert_equal @root1.children, [@root_child1, @root_child2]
+ assert_equal @root_child1.children, [@child1_child]
+ assert_equal @child1_child.children, []
+ assert_equal @root_child2.children, []
+ end
+
+ def test_parent
+ assert_equal @root_child1.parent, @root1
+ assert_equal @root_child1.parent, @root_child2.parent
+ assert_nil @root1.parent
+ end
+
+ def test_delete
+ assert_equal 6, TreeMixin.count
+ @root1.destroy
+ assert_equal 2, TreeMixin.count
+ @root2.destroy
+ @root3.destroy
+ assert_equal 0, TreeMixin.count
+ end
+
+ def test_insert
+ @extra = @root1.children.create
+
+ assert @extra
+
+ assert_equal @extra.parent, @root1
+
+ assert_equal 3, @root1.children.size
+ assert @root1.children.include?(@extra)
+ assert @root1.children.include?(@root_child1)
+ assert @root1.children.include?(@root_child2)
+ end
+
+ def test_ancestors
+ assert_equal [], @root1.ancestors
+ assert_equal [@root1], @root_child1.ancestors
+ assert_equal [@root_child1, @root1], @child1_child.ancestors
+ assert_equal [@root1], @root_child2.ancestors
+ assert_equal [], @root2.ancestors
+ assert_equal [], @root3.ancestors
+ end
+
+ def test_root
+ assert_equal @root1, TreeMixin.root
+ assert_equal @root1, @root1.root
+ assert_equal @root1, @root_child1.root
+ assert_equal @root1, @child1_child.root
+ assert_equal @root1, @root_child2.root
+ assert_equal @root2, @root2.root
+ assert_equal @root3, @root3.root
+ end
+
+ def test_roots
+ assert_equal [@root1, @root2, @root3], TreeMixin.roots
+ end
+
+ def test_siblings
+ assert_equal [@root2, @root3], @root1.siblings
+ assert_equal [@root_child2], @root_child1.siblings
+ assert_equal [], @child1_child.siblings
+ assert_equal [@root_child1], @root_child2.siblings
+ assert_equal [@root1, @root3], @root2.siblings
+ assert_equal [@root1, @root2], @root3.siblings
+ end
+
+ def test_self_and_siblings
+ assert_equal [@root1, @root2, @root3], @root1.self_and_siblings
+ assert_equal [@root_child1, @root_child2], @root_child1.self_and_siblings
+ assert_equal [@child1_child], @child1_child.self_and_siblings
+ assert_equal [@root_child1, @root_child2], @root_child2.self_and_siblings
+ assert_equal [@root1, @root2, @root3], @root2.self_and_siblings
+ assert_equal [@root1, @root2, @root3], @root3.self_and_siblings
+ end
+end
+
+class TreeTestWithEagerLoading < Test::Unit::TestCase
+
+ def setup
+ teardown_db
+ setup_db
+ @root1 = TreeMixin.create!
+ @root_child1 = TreeMixin.create! :parent_id => @root1.id
+ @child1_child = TreeMixin.create! :parent_id => @root_child1.id
+ @root_child2 = TreeMixin.create! :parent_id => @root1.id
+ @root2 = TreeMixin.create!
+ @root3 = TreeMixin.create!
+
+ @rc1 = RecursivelyCascadedTreeMixin.create!
+ @rc2 = RecursivelyCascadedTreeMixin.create! :parent_id => @rc1.id
+ @rc3 = RecursivelyCascadedTreeMixin.create! :parent_id => @rc2.id
+ @rc4 = RecursivelyCascadedTreeMixin.create! :parent_id => @rc3.id
+ end
+
+ def teardown
+ teardown_db
+ end
+
+ def test_eager_association_loading
+ roots = TreeMixin.find(:all, :include => :children, :conditions => "mixins.parent_id IS NULL", :order => "mixins.id")
+ assert_equal [@root1, @root2, @root3], roots
+ assert_no_queries do
+ assert_equal 2, roots[0].children.size
+ assert_equal 0, roots[1].children.size
+ assert_equal 0, roots[2].children.size
+ end
+ end
+
+ def test_eager_association_loading_with_recursive_cascading_three_levels_has_many
+ root_node = RecursivelyCascadedTreeMixin.find(:first, :include => { :children => { :children => :children } }, :order => 'mixins.id')
+ assert_equal @rc4, assert_no_queries { root_node.children.first.children.first.children.first }
+ end
+
+ def test_eager_association_loading_with_recursive_cascading_three_levels_has_one
+ root_node = RecursivelyCascadedTreeMixin.find(:first, :include => { :first_child => { :first_child => :first_child } }, :order => 'mixins.id')
+ assert_equal @rc4, assert_no_queries { root_node.first_child.first_child.first_child }
+ end
+
+ def test_eager_association_loading_with_recursive_cascading_three_levels_belongs_to
+ leaf_node = RecursivelyCascadedTreeMixin.find(:first, :include => { :parent => { :parent => :parent } }, :order => 'mixins.id DESC')
+ assert_equal @rc1, assert_no_queries { leaf_node.parent.parent.parent }
+ end
+end
+
+class TreeTestWithoutOrder < Test::Unit::TestCase
+
+ def setup
+ setup_db
+ @root1 = TreeMixinWithoutOrder.create!
+ @root2 = TreeMixinWithoutOrder.create!
+ end
+
+ def teardown
+ teardown_db
+ end
+
+ def test_root
+ assert [@root1, @root2].include?(TreeMixinWithoutOrder.root)
+ end
+
+ def test_roots
+ assert_equal [], [@root1, @root2] - TreeMixinWithoutOrder.roots
+ end
+end
View
0 vendor/plugins/acts_as_tree/test/database.yml
No changes.
View
0 vendor/plugins/acts_as_tree/test/fixtures/mixin.rb
No changes.
View
0 vendor/plugins/acts_as_tree/test/fixtures/mixins.yml
No changes.
View
0 vendor/plugins/acts_as_tree/test/schema.rb
No changes.
View
4 vendor/plugins/haml/init.rb
@@ -7,7 +7,9 @@
# gems:install may be run to install Haml with the skeleton plugin
# but not the gem itself installed.
# Don't die if this is the case.
- raise e unless defined?(Rake) && Rake.application.top_level_tasks.include?('gems:install')
+ raise e unless defined?(Rake) &&
+ (Rake.application.top_level_tasks.include?('gems') ||
+ Rake.application.top_level_tasks.include?('gems:install'))
end
end

0 comments on commit 74df7c3

Please sign in to comment.
Something went wrong with that request. Please try again.