diff options
author | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2012-01-04 13:30:57 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2012-01-04 13:30:57 -0300 |
commit | 761b049b2e51a035eaf9c18f4d0200409848a28e (patch) | |
tree | bdfed99b3d0b46ca7e2b079a46d46fa241549eab /activerecord | |
parent | 0bf51e9805260243ec0bbe5fca8f8b9364fdd970 (diff) | |
download | rails-761b049b2e51a035eaf9c18f4d0200409848a28e.tar.gz rails-761b049b2e51a035eaf9c18f4d0200409848a28e.tar.bz2 rails-761b049b2e51a035eaf9c18f4d0200409848a28e.zip |
No need to use rescue block to require psych
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 7 | ||||
-rw-r--r-- | activerecord/lib/active_record/fixtures/file.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/yaml_serialization_test.rb | 32 |
4 files changed, 17 insertions, 34 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index d29cf82dad..5ce78ca1c6 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1,8 +1,4 @@ -begin - require 'psych' -rescue LoadError -end - +require 'psych' require 'yaml' require 'set' require 'active_support/benchmarkable' diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 9ea8cf864c..8ae09d3e27 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -1,10 +1,5 @@ require 'erb' - -begin - require 'psych' -rescue LoadError -end - +require 'psych' require 'yaml' require 'zlib' require 'active_support/dependencies' diff --git a/activerecord/lib/active_record/fixtures/file.rb b/activerecord/lib/active_record/fixtures/file.rb index 6bad36abb9..f6fc883ee0 100644 --- a/activerecord/lib/active_record/fixtures/file.rb +++ b/activerecord/lib/active_record/fixtures/file.rb @@ -1,8 +1,4 @@ -begin - require 'psych' -rescue LoadError -end - +require 'psych' require 'erb' require 'yaml' diff --git a/activerecord/test/cases/yaml_serialization_test.rb b/activerecord/test/cases/yaml_serialization_test.rb index 2b4ec81199..dfdb27e5ab 100644 --- a/activerecord/test/cases/yaml_serialization_test.rb +++ b/activerecord/test/cases/yaml_serialization_test.rb @@ -1,4 +1,5 @@ -require "cases/helper" +require 'psych' +require 'cases/helper' require 'models/topic' class YamlSerializationTest < ActiveRecord::TestCase @@ -36,22 +37,17 @@ class YamlSerializationTest < ActiveRecord::TestCase assert_equal({'attributes' => topic.attributes}, coder) end - begin - require 'psych' - - def test_psych_roundtrip - topic = Topic.first - assert topic - t = Psych.load Psych.dump topic - assert_equal topic, t - end - - def test_psych_roundtrip_new_object - topic = Topic.new - assert topic - t = Psych.load Psych.dump topic - assert_equal topic.attributes, t.attributes - end - rescue LoadError + def test_psych_roundtrip + topic = Topic.first + assert topic + t = Psych.load Psych.dump topic + assert_equal topic, t + end + + def test_psych_roundtrip_new_object + topic = Topic.new + assert topic + t = Psych.load Psych.dump topic + assert_equal topic.attributes, t.attributes end end |