Advertisement
S-Mage

tests for #issue_id

Feb 21st, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.03 KB | None | 0 0
  1.  describe Timesheet::TogglRecord do
  2.   let!(:config)       { fixture('config', :yaml) }
  3.   let!(:toggl_record) { fixture('toggl_response')[:data].first }
  4.   let (:record)       { Timesheet::TogglRecord.new toggl_record, config }
  5.   context '#issue_id' do
  6.     it 'don\'t work if no redmine time entry class in config' do
  7.       record = Timesheet::TogglRecord.new({ description: 'hello' }, {})
  8.       params = { comment: '#1382 Alonsee!' }
  9.       expect(record.issue_id params).to be_nil
  10.     end
  11.  
  12.     context 'with redmine time entry class in config' do
  13.       it 'return nil if no #<issue_id> in comment' do
  14.         params = { comment: '1382 Alonsee!' }
  15.         expect(record.issue_id params).to be_nil
  16.       end
  17.  
  18.       it 'return id if it is given' do
  19.         params = { comment: '#1382 Alonsee!' }
  20.         expect(record.issue_id params).to eq 1382
  21.       end
  22.  
  23.       it 'allows space between # and number' do
  24.         params = { comment: '# 1382 Alonsee!' }
  25.         expect(record.issue_id params).to eq 1382
  26.       end
  27.     end
  28.   end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement