breezy_template 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,66 @@
1
+ # # taken from jbuilder's jbuilder_dependency_tracker_test.rb
2
+ #
3
+ # require 'test_helper'
4
+ # require 'breezy_template/dependency_tracker'
5
+ # require 'mocha'
6
+ #
7
+ # class FakeTemplate
8
+ # attr_reader :source, :handler
9
+ # def initialize(source, handler = :jbuilder)
10
+ # @source, @handler = source, handler
11
+ # end
12
+ # end
13
+ #
14
+ #
15
+ # class BreezyTemplateDependencyTrackerTest < ActiveSupport::TestCase
16
+ # def make_tracker(name, source)
17
+ # template = FakeTemplate.new(source)
18
+ # BreezyTemplate::DependencyTracker.new(name, template)
19
+ # end
20
+ #
21
+ # def track_dependencies(source)
22
+ # make_tracker('breezy_template', source).dependencies
23
+ # end
24
+ #
25
+ # test 'jbuilder direct partial! feature are not allowed' do
26
+ # dependencies = track_dependencies <<-RUBY
27
+ # json.partial! 'path/to/partial', foo: bar
28
+ # json.partial! 'path/to/another/partial', :fizz => buzz
29
+ # RUBY
30
+ #
31
+ # assert_equal [], dependencies
32
+ # end
33
+ #
34
+ # test 'detects partial with options (1.9 style)' do
35
+ # dependencies = track_dependencies <<-RUBY
36
+ # json.content hello: 'world', partial: 'path/to/partial', foo: :bar
37
+ # RUBY
38
+ #
39
+ # assert_equal %w[path/to/partial], dependencies
40
+ # end
41
+ #
42
+ # test 'detects partial with options (1.8 style)' do
43
+ # dependencies = track_dependencies <<-RUBY
44
+ # json.content :hello => 'world', :partial => 'path/to/partial', :foo => :bar
45
+ # RUBY
46
+ #
47
+ # assert_equal %w[path/to/partial], dependencies
48
+ # end
49
+ #
50
+ # test 'detects partial in indirect collecton calls' do
51
+ # dependencies = track_dependencies <<-RUBY
52
+ # json.comments @post.comments, partial: 'comments/comment', as: :comment
53
+ # RUBY
54
+ #
55
+ # assert_equal %w[comments/comment], dependencies
56
+ # end
57
+ #
58
+ # test 'detects explicit depedency' do
59
+ # dependencies = track_dependencies <<-RUBY
60
+ # # Template Dependency: path/to/partial
61
+ # json.foo 'bar'
62
+ # RUBY
63
+ #
64
+ # assert_equal %w[path/to/partial], dependencies
65
+ # end
66
+ # end
@@ -0,0 +1,17 @@
1
+ require 'rails'
2
+ require 'abstract_controller'
3
+ require 'abstract_controller/railties/routes_helpers'
4
+ require 'action_controller'
5
+ require "active_support"
6
+ require 'active_record'
7
+ require 'active_support/testing/autorun' if Rails.version >= '4'
8
+ require 'active_support/test_case'
9
+
10
+ ActiveSupport::TestCase.test_order = :random if ActiveSupport::TestCase.respond_to?(:test_order=)
11
+ ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
12
+ Rails.cache = ActiveSupport::Cache::MemoryStore.new
13
+
14
+ load File.dirname(__FILE__) + '/support/schema.rb'
15
+ require 'support/models'
16
+ require 'support/test_application'
17
+
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: breezy_template
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Johny Ho
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jbuilder
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: '1.5'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "<"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '1.5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: actionpack
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "<"
38
+ - !ruby/object:Gem::Version
39
+ version: '6.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '4.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: '6.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '4.0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: mocha
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ description: Breezy Templates for React props
68
+ email: jho406@gmail.com
69
+ executables: []
70
+ extensions: []
71
+ extra_rdoc_files: []
72
+ files:
73
+ - lib/breezy_template.rb
74
+ - lib/breezy_template/active_support.rb
75
+ - lib/breezy_template/cache_extension.rb
76
+ - lib/breezy_template/configuration.rb
77
+ - lib/breezy_template/deferment_extension.rb
78
+ - lib/breezy_template/dependency_tracker.rb
79
+ - lib/breezy_template/digestor.rb
80
+ - lib/breezy_template/handler.rb
81
+ - lib/breezy_template/partial_extension.rb
82
+ - lib/breezy_template/search_extension.rb
83
+ - lib/breezy_template/version.rb
84
+ - test/breezy_template_test.rb
85
+ - test/dependency_tracker_test.rb
86
+ - test/test_helper.rb
87
+ homepage: https://github.com/jho406/breezy/
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.4.5.1
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Breezy Templates for React props
111
+ test_files:
112
+ - test/breezy_template_test.rb
113
+ - test/dependency_tracker_test.rb
114
+ - test/test_helper.rb
115
+ has_rdoc: