diff --git a/.travis.yml b/.travis.yml index 1a9864b..00b98f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,3 @@ rvm: - 2.5.0 script: - bundle exec rspec - - bundle exec rspec spec/lib/instrumentation/as_notifications.rb diff --git a/spec/lib/instrumentation/as_notifications.rb b/spec/lib/instrumentation/as_notifications_spec.rb similarity index 80% rename from spec/lib/instrumentation/as_notifications.rb rename to spec/lib/instrumentation/as_notifications_spec.rb index 27bfdad..f7769ff 100644 --- a/spec/lib/instrumentation/as_notifications.rb +++ b/spec/lib/instrumentation/as_notifications_spec.rb @@ -1,11 +1,24 @@ require 'spec_helper' -require 'fast_jsonapi/instrumentation' describe FastJsonapi::ObjectSerializer do include_context 'movie class' context 'instrument' do + before(:all) do + require 'fast_jsonapi/instrumentation' + end + + after(:all) do + [ :serialized_json, :serializable_hash ].each do |m| + alias_command = "alias_method :#{m}, :#{m}_without_instrumentation" + FastJsonapi::ObjectSerializer.class_eval(alias_command) + + remove_command = "remove_method :#{m}_without_instrumentation" + FastJsonapi::ObjectSerializer.class_eval(remove_command) + end + end + before(:each) do options = {} options[:meta] = { total: 2 }