Permalink
Browse files

Clean up whitespace

  • Loading branch information...
1 parent 2991b56 commit 7ed94c91cdcbc1791e8d75eb81678f4eabc1363c @dewski dewski committed Feb 24, 2012
Showing with 33 additions and 33 deletions.
  1. +4 −4 Gemfile
  2. +1 −1 Rakefile
  3. +7 −7 test/compiler_test.rb
  4. +3 −3 test/elements_test.rb
  5. +10 −10 test/extensions_test.rb
  6. +8 −8 test/member_test.rb
View
@@ -1,10 +1,10 @@
-source "http://rubygems.org"
+source 'http://rubygems.org'
gemspec
gem 'rake'
group :test do
- gem 'i18n'
- gem 'tzinfo'
-end
+ gem 'i18n'
+ gem 'tzinfo'
+end
View
@@ -17,4 +17,4 @@ Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.test_files = FileList['test/*_test.rb']
t.verbose = true
-end
+end
View
@@ -13,7 +13,7 @@ def test_without_nesting
def valid?
true
end
-
+
name 'Garrett Bjerkhoel'
valid valid?
end
@@ -30,7 +30,7 @@ def test_support_all_dates
# The date will have the local time zone offset, hence the wildcard.
assert_match(%r{\{"date": "2011-11-23T00:00:00.*", "date_time": "2001-02-03T04:05:06Z", "timed": "2012-01-01T00:00:00Z", "zoned": "2012-01-01T00:00:00\+01:00"\}}, actual)
end
-
+
def test_should_support_all_datatypes
assert_builder_json('{"integer": 1, "mega_integer": 100000000, "float": 13.37, "true_class": true, "false_class": false, "missing_nil": null}') do
integer 1
@@ -41,7 +41,7 @@ def test_should_support_all_datatypes
missing_nil
end
end
-
+
def test_should_support_multiple_nestings
assert_builder_json('{"u": [{"id": 1, "l": [{"l": 1, "d": "t"}, {"l": 2, "d": "tt"}]}, {"id": 2, "l": [{"l": 2, "d": "t"}, {"l": 4, "d": "tt"}]}]}') do
u [1, 2] do |i|
@@ -55,28 +55,28 @@ def test_should_support_multiple_nestings
end
end
end
-
+
def test_support_custom_key_names
assert_builder_json('{"custom_key": 1, "with_method": "nope", "as_string": true, "nested": {"deep_down": -1, "custom": true}, "nope": "chuck"}') do
def with_method
"nope"
end
-
+
key :custom_key, 1
key :with_method, with_method
key 'as_string', true
nested do
def custom
'custom'
end
-
+
key 'deep_down', -1
key custom, true
end
key with_method, 'chuck'
end
end
-
+
def test_support_custom_classes
assert_builder_json('{"hello": "olleh"}') do
hello Dozer.new('hello')
View
@@ -4,15 +4,15 @@ class TestElements < Test::Unit::TestCase
def assert_elements_equal(value, array)
assert_equal value, JSONBuilder::Elements.new(nil, array).to_s
end
-
+
def test_array_hash
assert_elements_equal '[{"woot":true}]', [{ :woot => true }]
end
-
+
def test_custom_class_objects
assert_elements_equal '["olleh", "eybdoog"]', [Dozer.new('hello'), Dozer.new('goodbye')]
end
-
+
def test_raises_invalid_argument
assert_raises(JSONBuilder::InvalidArgument) {
JSONBuilder::Elements.new(nil, false).to_s
View
@@ -4,47 +4,47 @@ class TestExtensions < Test::Unit::TestCase
def test_string_respond_to
assert_respond_to 'json_builder', :to_builder
end
-
+
def test_ordered_hash
assert_respond_to ActiveSupport::OrderedHash.new(:json_builder => true), :to_builder
end
-
+
def test_true_value
assert_respond_to true, :to_builder
end
-
+
def test_false_value
assert_respond_to false, :to_builder
end
-
+
def test_hash_value
assert_respond_to({ :json_builder => true }, :to_builder)
end
-
+
def test_nil_value
assert_respond_to nil, :to_builder
end
-
+
def test_time_with_zone_value
assert_respond_to Time.zone.now, :to_builder
end
def test_time_value
assert_respond_to Time.utc(2012), :to_builder
end
-
+
def test_date_value
assert_respond_to Date.parse('2012-01-01'), :to_builder
end
-
+
def test_datetime_value
assert_respond_to DateTime.parse('2012-01-01'), :to_builder
end
-
+
def test_bson_objectid_value
assert_respond_to BSON::ObjectId.new, :to_builder
end
-
+
def test_custom_class
assert_respond_to Dozer.new('hello'), :to_builder
end
View
@@ -10,35 +10,35 @@ def member(key, value=nil, &block)
def test_is_a_builder_value
assert_equal JSONBuilder::Member, member(:hello, true).class
end
-
+
def test_key_as_symbol
assert_equal '"hello": true', member(:hello, true).to_s
end
-
+
def test_key_as_unicoded_symbol
assert_equal '"hellyé": true', member(:hellyé, true).to_s
end
-
+
def test_key_as_string
assert_equal '"hello": true', member('hello', true).to_s
end
-
+
def test_value_as_array
assert_equal '"hello": [{"ruby":true}]', member('hello', [{ :ruby => true }]).to_s
end
-
+
def test_value_as_block
assert_equal '"hello": "hi"', member('hello') { "hi" }.to_s
end
-
+
def test_value_as_block_with_hash
assert_equal '"hello": {"ruby":true}', member('hello') { { :ruby => true } }.to_s
end
-
+
def test_custom_class
assert_equal '"hello": "olleh"', member('hello', Dozer.new('hello')).to_s
end
-
+
def test_without_key
assert_raises(JSONBuilder::MissingKeyError) { member(nil, true).to_s }
end

0 comments on commit 7ed94c9

Please sign in to comment.