Sha256: adec7b6c0029cbc82b5368691bfcfeaf48c248a2afb874f3eb22da0308a4bafe

Contents?: true

Size: 1.72 KB

Versions: 8

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe Lita::Handlers::JiraUtility, lita_handler: true do
  it do
    is_expected.to route_command('jira identify user@example.com').to(:identify)
    is_expected.to route_command('jira forget').to(:forget)
    is_expected.to route_command('jira whoami').to(:whoami)
  end

  describe '#identify' do
    it 'remembers the user if they do not already have an email address stored' do
      send_command('jira identify user@example.com')
      expect(replies.last).to eq('You have been identified as user@example.com to JIRA')
    end

    it 'warns the user if they have already stored an email address' do
      send_command('jira identify user@example.com')
      send_command('jira identify otheruser@example.com')
      expect(replies.last).to eq('You are already identified as user@example.com')
    end
  end

  describe '#forget' do
    it 'forgets the user if they have an email address stored' do
      send_command('jira identify user@example.com')
      send_command('jira forget')
      expect(replies.last).to eq('You have been de-identified from JIRA')
    end

    it 'warns the user if they did not have a stored email address' do
      send_command('jira forget')
      expect(replies.last).to eq('You do not have an email address on record')
    end
  end

  describe '#whoami' do
    it 'shows the current stored email address if one exists' do
      send_command('jira identify user@example.com')
      send_command('jira whoami')
      expect(replies.last).to eq('You are identified with JIRA as user@example.com')
    end

    it 'warns the user if there is no stored address' do
      send_command('jira whoami')
      expect(replies.last).to eq('You do not have an email address on record')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lita-jira-0.8.1 spec/lita/handlers/jira_utility_spec.rb
lita-jira-0.8.0 spec/lita/handlers/jira_utility_spec.rb
lita-jira-0.7.2 spec/lita/handlers/jira_utility_spec.rb
lita-jira-0.7.1 spec/lita/handlers/jira_utility_spec.rb
lita-jira-0.7.0 spec/lita/handlers/jira_utility_spec.rb
lita-jira-0.6.0 spec/lita/handlers/jira_utility_spec.rb
lita-jira-0.5.0 spec/lita/handlers/jira_utility_spec.rb
lita-jira-0.4.0 spec/lita/handlers/jira_utility_spec.rb