soca 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,39 +0,0 @@
1
- require 'helper'
2
-
3
- class TestSocaPusher < Test::Unit::TestCase
4
-
5
- context "macro plugin" do
6
- setup do
7
- @pusher = Soca::Pusher.new(@test_app_dir)
8
- @sammy = File.read("#{@test_app_dir}/js/vendor/sammy-0.5.4.js")
9
- @views = "#{@test_app_dir}/db/views/"
10
- end
11
-
12
- should "replace !code macros with file contents" do
13
- @pusher.push!
14
- assert @pusher.document['views']['recent'].all?{|part| part[1].include?(@sammy)}
15
- end
16
-
17
- should "keep the original code" do
18
- @pusher.push!
19
- parts = ['map','reduce'].inject({}){|res,part| res[part] = File.read("#{@views}/recent/#{part}.js").split("\n");res}
20
- parts.each do |part,lines|
21
- assert contain_lines(part,lines)
22
- end
23
- end
24
-
25
- should "be able to process views with map only" do
26
- @pusher.push!
27
- lines = File.read("#{@views}/only_map/map.js").split("\n")
28
- assert contain_lines('map',lines)
29
-
30
- end
31
- end
32
-
33
- def contain_lines(part,lines)
34
- lines.delete(' // !code js/vendor/sammy-0.5.4.js')
35
- lines.all? { |line| @pusher.document['views']['recent'][part].include?(line)}
36
- end
37
-
38
-
39
- end