test coverage and cleanup in anticipation of merge
This commit is contained in:
parent
634f60ffe6
commit
edf5a49f27
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ jhw-test
|
||||
.jhw-cache/
|
||||
_site/
|
||||
jhw.*.html
|
||||
coverage/
|
||||
|
20
lib/digest/jasmine_test.rb
Normal file
20
lib/digest/jasmine_test.rb
Normal file
@ -0,0 +1,20 @@
|
||||
module Digest
|
||||
class JasmineTest
|
||||
def self.file(file)
|
||||
new
|
||||
end
|
||||
|
||||
def file(file)
|
||||
self
|
||||
end
|
||||
|
||||
def hexdigest
|
||||
'test'
|
||||
end
|
||||
|
||||
def update(prefix)
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,7 @@
|
||||
require 'jasmine/headless'
|
||||
require 'jasmine/headless/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
|
||||
|
||||
module Digest
|
||||
autoload :JasmineTest, 'digest/jasmine_test'
|
||||
end
|
||||
|
||||
|
@ -107,10 +107,6 @@ module Jasmine::Headless
|
||||
@sprockets_environment
|
||||
end
|
||||
|
||||
def path_searcher
|
||||
@path_searcher ||= PathSearcher.new(self)
|
||||
end
|
||||
|
||||
def has_spec_outside_scope?
|
||||
if is_outside_scope = !spec_filter.empty?
|
||||
is_outside_scope = spec_dir.any? do |dir|
|
||||
@ -244,10 +240,6 @@ module Jasmine::Headless
|
||||
end
|
||||
end
|
||||
|
||||
def include_spec_file?(file)
|
||||
spec_filter.empty? || spec_filter.include?(file)
|
||||
end
|
||||
|
||||
def src_dir
|
||||
config_dir_or_pwd('src_dir')
|
||||
end
|
||||
|
@ -1,23 +1,3 @@
|
||||
module Digest
|
||||
class JasmineTest
|
||||
def self.file(file)
|
||||
new
|
||||
end
|
||||
|
||||
def file(file)
|
||||
self
|
||||
end
|
||||
|
||||
def hexdigest
|
||||
'test'
|
||||
end
|
||||
|
||||
def update(prefix)
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Jasmine
|
||||
module Headless
|
||||
class Task
|
||||
@ -41,7 +21,6 @@ module Jasmine
|
||||
private
|
||||
def create_rails_compliant_task
|
||||
if Rails.respond_to?(:version) && Rails.version >= "3.1.0"
|
||||
desc 'Force generate static assets without an MD5 hash, all assets end with -test.<ext>'
|
||||
task 'assets:precompile:for_testing' => :environment do
|
||||
$stderr.puts "This task is deprecated and will be removed after 2012-01-01"
|
||||
|
||||
|
25
spec/lib/jasmine/headless/css_template_spec.rb
Normal file
25
spec/lib/jasmine/headless/css_template_spec.rb
Normal file
@ -0,0 +1,25 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Jasmine::Headless::CSSTemplate do
|
||||
include FakeFS::SpecHelpers
|
||||
|
||||
let(:template) { described_class.new(file) { data } }
|
||||
let(:file) { 'file' }
|
||||
let(:data) { 'data' }
|
||||
|
||||
subject { template.render }
|
||||
|
||||
before do
|
||||
File.open(file, 'wb') if file
|
||||
end
|
||||
|
||||
context "no file'" do
|
||||
let(:file) { nil }
|
||||
|
||||
it { should == data }
|
||||
end
|
||||
|
||||
context 'file' do
|
||||
it { should == %{<link rel="stylesheet" href="#{file}" type="text/css" />} }
|
||||
end
|
||||
end
|
31
spec/lib/jasmine/headless/js_template_spec.rb
Normal file
31
spec/lib/jasmine/headless/js_template_spec.rb
Normal file
@ -0,0 +1,31 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Jasmine::Headless::JSTemplate do
|
||||
include FakeFS::SpecHelpers
|
||||
|
||||
let(:template) { described_class.new(file) { data } }
|
||||
let(:file) { 'file' }
|
||||
let(:data) { 'data' }
|
||||
|
||||
subject { template.render }
|
||||
|
||||
before do
|
||||
File.open(file, 'wb') if file
|
||||
end
|
||||
|
||||
context "no file'" do
|
||||
let(:file) { nil }
|
||||
|
||||
it { should == data }
|
||||
end
|
||||
|
||||
context 'file' do
|
||||
it { should == %{<script type="text/javascript" src="#{file}"></script>} }
|
||||
end
|
||||
|
||||
context 'jhw content' do
|
||||
let(:data) { 'from="jhw"' }
|
||||
|
||||
it { should == data }
|
||||
end
|
||||
end
|
21
spec/lib/jasmine/headless/jst_template_spec.rb
Normal file
21
spec/lib/jasmine/headless/jst_template_spec.rb
Normal file
@ -0,0 +1,21 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Jasmine::Headless::JSTTemplate do
|
||||
include FakeFS::SpecHelpers
|
||||
|
||||
let(:template) { described_class.new(file) }
|
||||
let(:file) { 'file' }
|
||||
let(:data) { 'data' }
|
||||
|
||||
let(:context) { stub(:logical_path => 'path') }
|
||||
|
||||
before do
|
||||
File.open(file, 'wb') { |fh| fh.print data }
|
||||
end
|
||||
|
||||
subject { template.render(context) }
|
||||
|
||||
it { should include(%{<script type="text/javascript">}) }
|
||||
it { should include(data) }
|
||||
end
|
||||
|
@ -1,3 +1,8 @@
|
||||
if ENV['COVERAGE']
|
||||
require 'simplecov'
|
||||
SimpleCov.start
|
||||
end
|
||||
|
||||
require 'jasmine-headless-webkit'
|
||||
require 'fakefs/spec_helpers'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user