Class: Spex::ChangedModeCheck
- Defined in:
- lib/spex/checks/changed_mode_check.rb
Instance Attribute Summary
Attributes inherited from Check
Instance Method Summary collapse
Methods inherited from FileCheck
Methods inherited from Check
[], #active?, as, each, example, examples, #initialize, option, options, #prepare, registry, #validate!
Constructor Details
This class inherits a constructor from Spex::Check
Instance Method Details
#after ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/spex/checks/changed_mode_check.rb', line 22 def after assert File.exist?(target), "File does not exist at #{target}" mode = current_mode.to_s(8) if [:to] assert_equal [:to].to_s(8), mode elsif active? assert_not_equal @before_mode.to_s(8), mode, "Mode is still #{@before_mode.to_s(8)}" elsif !active? assert_equal @before_mode.to_s(8), mode, "Mode was changed from #{@before_mode.to_s(8)} to #{mode}" end end |
#before ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/spex/checks/changed_mode_check.rb', line 12 def before assert File.exist?(target), "File does not exist at #{target}" if [:from] assert_equal [:from].to_s(8), current_mode.to_s(8) elsif [:to] assert_not_equal [:to].to_s(8), current_mode.to_s(8), "Mode will not be changed; already at mode #{[:to].to_s(8)}" end @before_mode = current_mode end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/spex/checks/changed_mode_check.rb', line 34 def to_s [super, detail].join(' ') end |