shopify_liquid_test_helper 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78ab883c518d4cb5d8e2bee3c6cb8c4f65781724f3d5e7e093f55b5e108e041c
4
- data.tar.gz: 1d1d92e1d5e717b655152a320bcbb69cc72eebc111756d0e4f969af1a97c5e45
3
+ metadata.gz: 84284c898f11a3cdb722b02acd0ec877884b31a05fa0898ab5e7a928e6f20cae
4
+ data.tar.gz: c998c86408b453d132537b191f94faa96b5cd7f98459e948ccb8a41871fa4a5c
5
5
  SHA512:
6
- metadata.gz: 6559b4229c6fa3ef893499b7bc4d397d9dc270d840b1b33e9871004b84549857e1e646d272f0c2a9719d0db71f324d5b4eb06940702b126f49f8f9bf1992b3c3
7
- data.tar.gz: a1aa6a1ed00f58fc7648aec4e625417ad59f2fe9fefd64f93c05535cda798af44d1eeb599439f7cc98ab27d2b89eaa8c2216f04811f4ced877e922aec4101053
6
+ metadata.gz: 125d273dc6e140eadd9cc06d0cf788948d3ec1cc66089cfc7c3b27da865b0d4d3a83c388a0db69b3634067aeab525cc0e3e21a6cbb181d16bea0c01999935769
7
+ data.tar.gz: 6716beb9dfa4bfb3c6dc44ecf7bec268642bab035adfb595478e12eea4611bbbf4c2afcbd536976907d78849b7e743175d3c70a9af785dda59285b37919c4a38
data/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ShopifyLiquidTestHelper is a Ruby gem designed to assist in testing Shopify Liquid templates. It provides custom Liquid tags and helper methods that simulate Shopify-specific functionality, making it easier to test your Liquid templates in isolation.
4
4
 
5
+ ## Tag Status
6
+
7
+ | Tag | Status |
8
+ | --- | ------ |
9
+ | `render` | ✅ |
10
+ | `capture` | ✅ |
11
+
12
+
5
13
  ## Installation
6
14
 
7
15
  Add this line to your application's Gemfile:
@@ -53,7 +61,7 @@ RSpec.describe "Product template" do
53
61
  it "renders the product title" do
54
62
  template = "{% render 'product_title' %}"
55
63
  assigns = { 'product' => { 'title' => 'Awesome T-Shirt' } }
56
- result = ShopifyLiquidTestHelper.render_template(Liquid::Template.parse(template), assigns)
64
+ result = Liquid::Template.parse(template).render(assigns)
57
65
  expect(result).to eq '<h1>Awesome T-Shirt</h1>'
58
66
  end
59
67
  end
@@ -70,7 +78,7 @@ RSpec.describe "Collection template" do
70
78
  it "renders a list of product titles" do
71
79
  template = "{% render 'product_list' for products %}"
72
80
  assigns = { 'products' => [{ 'title' => 'Shirt' }, { 'title' => 'Pants' }] }
73
- result = ShopifyLiquidTestHelper.render_template(Liquid::Template.parse(template), assigns)
81
+ result = Liquid::Template.parse(template).render(assigns)
74
82
  expect(result).to eq 'ShirtPants'
75
83
  end
76
84
  end
@@ -83,7 +91,7 @@ RSpec.describe "Capture tag" do
83
91
  it "captures content into a variable" do
84
92
  template = "{% capture my_variable %}Hello, {{ name }}!{% endcapture %}{{ my_variable }}"
85
93
  assigns = { 'name' => 'World' }
86
- result = ShopifyLiquidTestHelper.render_template(Liquid::Template.parse(template), assigns)
94
+ result = Liquid::Template.parse(template).render(assigns)
87
95
  expect(result).to eq 'Hello, World!'
88
96
  end
89
97
  end
@@ -121,7 +129,7 @@ RSpec.describe "Product listing" do
121
129
  'price' => 1999
122
130
  }
123
131
  }
124
- result = ShopifyLiquidTestHelper.render_template(Liquid::Template.parse(template), assigns)
132
+ result = Liquid::Template.parse(template).render(assigns)
125
133
  expect(result).to include('Awesome T-Shirt')
126
134
  expect(result).to include('Price: $19.99')
127
135
  end
@@ -161,7 +169,7 @@ RSpec.describe "Mixed snippet sources" do
161
169
  'price' => 2499
162
170
  }
163
171
  }
164
- result = ShopifyLiquidTestHelper.render_template(Liquid::Template.parse(template), assigns)
172
+ result = Liquid::Template.parse(template).render(assigns)
165
173
  expect(result).to include('This is an inline snippet')
166
174
  expect(result).to include('Cool Product')
167
175
  expect(result).to include('Price: $24.99')
@@ -10,11 +10,8 @@ module ShopifyLiquidTestHelper
10
10
  Liquid::Template.parse(File.read(template_name))
11
11
  end
12
12
 
13
- def render_template(template, assigns)
14
- template.render(assigns).strip
15
- end
16
-
17
13
  def register_custom_tags
14
+ # TODO: separate tag implementations
18
15
  Liquid::Template.register_tag('render', RenderTag)
19
16
  Liquid::Template.register_tag('capture', CaptureTag)
20
17
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe ShopifyLiquidTestHelper do
3
+ RSpec.describe ShopifyLiquidTestHelper::RenderTag do
4
4
  before(:all) do
5
5
  ShopifyLiquidTestHelper.register_custom_tags
6
6
  ShopifyLiquidTestHelper.register_snippet('simple', 'Hello, {{ name }}!')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_liquid_test_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Takagiwa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2024-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -65,7 +65,7 @@ files:
65
65
  - lib/shopify_liquid_test_helper.rb
66
66
  - lib/shopify_liquid_test_helper/capture_tag.rb
67
67
  - lib/shopify_liquid_test_helper/render_tag.rb
68
- - spec/shopify_liquid_test_helper_spec.rb
68
+ - spec/render_tag_spec.rb
69
69
  - spec/spec_helper.rb
70
70
  homepage: https://github.com/yourusername/shopify_liquid_test_helper
71
71
  licenses: