cacheable actions write out better filenames, and get rid of local jquery and use jquery-rails gem for testing
This commit is contained in:
parent
4ae9815471
commit
ee3b6e598c
@ -1,5 +1,3 @@
|
|||||||
require 'digest/sha1'
|
|
||||||
|
|
||||||
module Jasmine::Headless
|
module Jasmine::Headless
|
||||||
class CacheableAction
|
class CacheableAction
|
||||||
class << self
|
class << self
|
||||||
@ -56,7 +54,7 @@ module Jasmine::Headless
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cache_file
|
def cache_file
|
||||||
@cache_file ||= File.join(self.class.cache_dir, self.class.cache_type, Digest::SHA1.hexdigest(file)) + '.js'
|
@cache_file ||= File.join(self.class.cache_dir, self.class.cache_type, file) + '.js'
|
||||||
end
|
end
|
||||||
|
|
||||||
def fresh?
|
def fresh?
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#= require jquery
|
||||||
|
|
||||||
describe 'console.log', ->
|
describe 'console.log', ->
|
||||||
it 'should not eat my precious jqueries', ->
|
it 'should not eat my precious jqueries', ->
|
||||||
_log = JHW.log
|
_log = JHW.log
|
||||||
|
18
spec/javascripts/support/jquery-1.6.2.min.js
vendored
18
spec/javascripts/support/jquery-1.6.2.min.js
vendored
File diff suppressed because one or more lines are too long
@ -3,12 +3,15 @@ require 'spec_helper'
|
|||||||
describe Jasmine::Headless::CacheableAction do
|
describe Jasmine::Headless::CacheableAction do
|
||||||
include FakeFS::SpecHelpers
|
include FakeFS::SpecHelpers
|
||||||
|
|
||||||
let(:file) { 'file.whatever' }
|
let(:file) { 'dir/file.whatever' }
|
||||||
let(:data) { 'data' }
|
let(:data) { 'data' }
|
||||||
let(:compiled) { 'compiled' }
|
let(:compiled) { 'compiled' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
FileUtils.mkdir_p File.dirname(file)
|
||||||
|
|
||||||
File.open(file, 'wb') { |fh| fh.print(data) }
|
File.open(file, 'wb') { |fh| fh.print(data) }
|
||||||
|
|
||||||
described_class.cache_dir = cache_dir
|
described_class.cache_dir = cache_dir
|
||||||
described_class.cache_type = cache_type
|
described_class.cache_type = cache_type
|
||||||
end
|
end
|
||||||
@ -19,7 +22,7 @@ describe Jasmine::Headless::CacheableAction do
|
|||||||
|
|
||||||
let(:cache_type) { 'action' }
|
let(:cache_type) { 'action' }
|
||||||
let(:cache_dir) { 'cache' }
|
let(:cache_dir) { 'cache' }
|
||||||
let(:cache_file) { File.join(cache_dir, cache_type, Digest::SHA1.hexdigest(file)) + '.js' }
|
let(:cache_file) { File.join(cache_dir, cache_type, file) + '.js' }
|
||||||
let(:cache_file_data) { YAML.load(File.read(cache_file)) }
|
let(:cache_file_data) { YAML.load(File.read(cache_file)) }
|
||||||
|
|
||||||
let(:cache_object) { described_class.new(file) }
|
let(:cache_object) { described_class.new(file) }
|
||||||
|
Loading…
Reference in New Issue
Block a user