Sha256: 4c785db121c2667f596f91ddbd760f73441a8ab95ab8f2e4a47b7e9e2b8de089
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module Siesta class TestSuite class Group include ::Virtus attribute :path, String attribute :suite, TestSuite def name @name ||= path.gsub(suite.path, '') @name.blank? ? 'global' : @name end def items @items ||= Dir.glob(File.join(path, '*.t.js')).inject([]) do |c, f| c << Item.new(:path => f, :group => self, :suite => suite) unless File.directory?(f) c end end end class Item include ::Virtus attribute :path, String attribute :group, Group attribute :suite, TestSuite def url @url ||= File.join('/assets', path.gsub(suite.path, '')) end end attr_reader :path def initialize(path) @path = path end def groups return @groups if @groups @groups = Dir.glob(File.join(path, '**', '*')).inject([]) do |c, f| c << Group.new(:path => f, :suite => self) if has_tests?(f) c end @groups << Group.new(:path => path, :suite => self) if has_tests?(path) @groups end def has_tests?(path) File.directory?(f) && !Dir[File.join(f, '*.t.js')].empty? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
siesta-0.1.2 | lib/siesta/test_suite.rb |