Module: Magick::TestingHelpers::ClassMethods

Defined in:
lib/magick/testing_helpers.rb

Instance Method Summary collapse

Instance Method Details

#with_feature_disabled(feature_name) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/magick/testing_helpers.rb', line 19

def with_feature_disabled(feature_name)
  feature = Magick.features[feature_name.to_s] || Magick[feature_name]
  original_value = feature.value
  feature.set_value(false)
  yield
ensure
  feature.set_value(original_value)
end

#with_feature_enabled(feature_name) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/magick/testing_helpers.rb', line 10

def with_feature_enabled(feature_name)
  feature = Magick.features[feature_name.to_s] || Magick[feature_name]
  original_value = feature.value
  feature.set_value(true)
  yield
ensure
  feature.set_value(original_value)
end

#with_feature_value(feature_name, value) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/magick/testing_helpers.rb', line 28

def with_feature_value(feature_name, value)
  feature = Magick.features[feature_name.to_s] || Magick[feature_name]
  original_value = feature.value
  feature.set_value(value)
  yield
ensure
  feature.set_value(original_value)
end