Skip to content

Commit

Permalink
Merge pull request #22 from veracross/test-character-encodings
Browse files Browse the repository at this point in the history
Add emoji to test template values to test we can deal with unicode
  • Loading branch information
aharpervc authored Jun 27, 2019
2 parents ac2dbb4 + 4a088f7 commit 40812ce
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/consult/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def contents

def consul_contents(location)
[@config[location]].compact.flatten.map do |key|
Diplomat::Kv.get(key, options: nil, not_found: :return, found: :return)
Diplomat::Kv.get(key, options: nil, not_found: :return, found: :return).force_encoding 'utf-8'
end.join
end

Expand Down
4 changes: 2 additions & 2 deletions spec/support/expected/consul_elements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Earth is the 4th element
Love is the 5th element!
Earth is the 4th element 🌎
Love is the 5th element! πŸ’—
4 changes: 2 additions & 2 deletions spec/support/expected/elements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Air is the 1st element
Fire is the 2nd element
Air is the 1st element πŸ’¨
Fire is the 2nd element πŸ”₯
6 changes: 3 additions & 3 deletions spec/support/expected/more_consul_elements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Earth is the 4th element
Love is the 5th element!
Aziz! Light!
Earth is the 4th element 🌎
Love is the 5th element! πŸ’—
Aziz! Light! πŸ™„
6 changes: 3 additions & 3 deletions spec/support/expected/more_elements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Air is the 1st element
Fire is the 2nd element
Water is the 3rd element
Air is the 1st element πŸ’¨
Fire is the 2nd element πŸ”₯
Water is the 3rd element πŸ’§
12 changes: 6 additions & 6 deletions spec/support/expected/multi_pass.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Air is the 1st element
Earth is the 4th element
Fire is the 2nd element
Water is the 3rd element
Love is the 5th element!
Aziz! Light!
Air is the 1st element πŸ’¨
Earth is the 4th element 🌎
Fire is the 2nd element πŸ”₯
Water is the 3rd element πŸ’§
Love is the 5th element! πŸ’—
Aziz! Light! πŸ™„
9 changes: 6 additions & 3 deletions spec/support/populate_consul.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ curl \

curl \
--request PUT \
--data $'Earth is the <%= vars[:earth] %>th element\n' \
-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" \
--data $'Earth is the <%= vars[:earth] %>th element 🌎\n' \
http://localhost:8500/v1/kv/templates/elements/earth

curl \
--request PUT \
--data $'Love is the <%= vars[:love] %>th element!\n' \
-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" \
--data $'Love is the <%= vars[:love] %>th element! πŸ’—\n' \
http://localhost:8500/v1/kv/templates/elements/love

curl \
--request PUT \
--data $'Aziz! <%= vars[:aziz] %>\n' \
-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" \
--data $'Aziz! <%= vars[:aziz] %> πŸ™„\n' \
http://localhost:8500/v1/kv/templates/elements/aziz
2 changes: 1 addition & 1 deletion spec/support/templates/elements/air.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Air is the <%= vars[:air] %>st element
Air is the <%= vars[:air] %>st element πŸ’¨
2 changes: 1 addition & 1 deletion spec/support/templates/elements/fire.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fire is the <%= vars[:fire] %>nd element
Fire is the <%= vars[:fire] %>nd element πŸ”₯
2 changes: 1 addition & 1 deletion spec/support/templates/elements/water.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Water is the <%= vars[:water] %>rd element
Water is the <%= vars[:water] %>rd element πŸ’§

0 comments on commit 40812ce

Please sign in to comment.