Module: Rasta::Fixture::RastaFixture::TestCaseHelperMethods

Defined in:
lib/rasta/fixture/rasta_fixture.rb

Constant Summary collapse

@@actual_value =
nil

Instance Method Summary collapse

Instance Method Details

#check_for_errorsObject



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/rasta/fixture/rasta_fixture.rb', line 113

def check_for_errors
  if @exception_expected
    if @exception
      lambda{ @fixture.send @cell.header }.should raise_error(@exception, @exception_message)
    else
      lambda{ @fixture.send @cell.header }.should raise_error
    end
  else
    lambda{ @@actual_value = @fixture.send @cell.header }.should_not raise_error
  end
end

#check_test_resultObject



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/rasta/fixture/rasta_fixture.rb', line 125

def check_test_result
  return if @exception_expected
  # Allow spreadsheet values of nil be captured to 
  # run methods that do not have a return. This is done 
  # this way because if we tranlated the cell value to nil then
  # we couldn't tell the difference between a cell=nil vs an empty cell
  if @cell.value == 'nil'
    expected_value = nil
  else
    expected_value = @cell.value
  end
  case expected_value
  when /^(<=|>=|>|<)(.+)/  
    eval("@@actual_value.should #{$1} #{$2}")
  when Regexp
    @@actual_value.should =~ expected_value
  else
    @@actual_value.should == expected_value
  end
end

#set_pending_statusObject



146
147
148
149
150
# File 'lib/rasta/fixture/rasta_fixture.rb', line 146

def set_pending_status
  if @fixture.methods.include?('pending') and @fixture.pending
    pending(@fixture.pending)
  end  
end