Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

split and sort renderer_tests

  • Loading branch information...
commit 1f686af827e8edcc44acdad60da46191f01ffaa1 1 parent b72124f
Nathan Esquenazi authored
Showing with 14 additions and 14 deletions.
  1. +14 −14 test/renderer_test.rb
28 test/renderer_test.rb
View
@@ -64,8 +64,8 @@
user = User.new(:name => 'irvine')
renderer = Rabl::Renderer.new(source, nil, { :format => 'json', :locals => {:object => user} })
- renderer.render.split("")
- end.equals "{\"user\":{\"city\":\"irvine\"}}".split("")
+ renderer.render.split("").sort
+ end.equals "{\"user\":{\"city\":\"irvine\"}}".split("").sort
asserts 'loads source from file' do
@@ -79,8 +79,8 @@
user = User.new(:name => 'irvine')
renderer = Rabl::Renderer.new('test', user, :view_path => tmp_path)
- renderer.render.split("")
- end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}".split("")
+ renderer.render.split("").sort
+ end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}".split("").sort
asserts 'handles paths for extends' do
@@ -101,8 +101,8 @@
user = User.new(:name => 'irvine')
renderer = Rabl::Renderer.new('user', user, :view_path => tmp_path)
- renderer.render.split("")
- end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}".split("")
+ renderer.render.split("").sort
+ end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}".split("").sort
asserts 'Rabl.render calls Renderer' do
File.open(tmp_path + "test.json.rabl", "w") do |f|
@@ -114,8 +114,8 @@
user = User.new(:name => 'irvine')
- Rabl.render(user, 'test', :view_path => tmp_path).split("")
- end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}".split("")
+ Rabl.render(user, 'test', :view_path => tmp_path).split("").sort
+ end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}".split("").sort
asserts 'it renders collections' do
File.open(tmp_path + "test.json.rabl", "w") do |f|
@@ -127,8 +127,8 @@
scope = Object.new
scope.instance_variable_set :@users, nil
- Rabl.render([], 'test', :view_path => tmp_path, :scope => scope).split("")
- end.equals "{\"users\":[]}".split("")
+ Rabl.render([], 'test', :view_path => tmp_path, :scope => scope).split("").sort
+ end.equals "{\"users\":[]}".split("").sort
asserts 'it renders an array when given an empty collection' do
File.open(tmp_path + "test.json.rabl", "w") do |f|
@@ -154,8 +154,8 @@
end
user = User.new(:name => 'ivan')
- Rabl::Renderer.json(user, 'test', :view_path => tmp_path).split("")
- end.equals "{\"user\":{\"age\":24,\"name\":\"ivan\"}}".split("")
+ Rabl::Renderer.json(user, 'test', :view_path => tmp_path).split("").sort
+ end.equals "{\"user\":{\"age\":24,\"name\":\"ivan\"}}".split("").sort
end
context '.msgpack' do
@@ -168,8 +168,8 @@
end
user = User.new(:name => 'ivan')
- Rabl::Renderer.msgpack(user, 'test', :view_path => tmp_path).split("")
- end.equals "\x81\xA4user\x82\xA3age\x18\xA4name\xA4ivan".split("")
+ Rabl::Renderer.msgpack(user, 'test', :view_path => tmp_path).split("").sort
+ end.equals "\x81\xA4user\x82\xA3age\x18\xA4name\xA4ivan".split("").sort
end
context '.plist' do
Please sign in to comment.
Something went wrong with that request. Please try again.