spec/cinch-karma_spec.rb in cinch-karma-1.0.3 vs spec/cinch-karma_spec.rb in cinch-karma-1.0.4

- old
+ new

@@ -2,71 +2,81 @@ describe Cinch::Plugins::Karma do include Cinch::Test before(:each) do - @bot = make_bot(Cinch::Plugins::Karma, { :filename => '/dev/null' }) + @bot = make_bot(Cinch::Plugins::Karma, { filename: '/dev/null' }) end it 'should default to zero karma' do - msg = make_message(@bot, '!karma foo', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo is 0" + msg = make_message(@bot, '!karma foo', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo is 0') end it 'should allow users to add karma' do - msg = make_message(@bot, 'foo++', { :channel => '#foo' }) + msg = make_message(@bot, 'foo++', { channel: '#foo' }) get_replies(msg) - msg = make_message(@bot, '!karma foo', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo is 1" + msg = make_message(@bot, '!karma foo', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo is 1') end it 'should allow users to add karma mid message' do - msg = make_message(@bot, 'd asd asdasd foo++ dasdasd sadasd sad', { :channel => '#foo' }) + msg = make_message(@bot, 'd asd asdasd foo++ dasdasd sadasd sad', { channel: '#foo' }) get_replies(msg) - msg = make_message(@bot, '!karma foo', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo is 1" + msg = make_message(@bot, '!karma foo', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo is 1') end it 'should allow users to add karma with items with spaces via ()' do - msg = make_message(@bot, '(foo bar)++', { :channel => '#foo' }) + msg = make_message(@bot, '(foo bar)++', { channel: '#foo' }) get_replies(msg) - msg = make_message(@bot, '!karma foo bar', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo bar is 1" + msg = make_message(@bot, '!karma foo bar', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo bar is 1') end it 'should allow users to remove karma' do - msg = make_message(@bot, 'foo--', { :channel => '#foo' }) + msg = make_message(@bot, 'foo--', { channel: '#foo' }) get_replies(msg) - msg = make_message(@bot, '!karma foo', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo is -1" + msg = make_message(@bot, '!karma foo', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo is -1') end it 'should allow users to remove karma mid message' do - msg = make_message(@bot, 'd asd asdasd foo-- dasdasd sadasd sad', { :channel => '#foo' }) + msg = make_message(@bot, 'd asd asdasd foo-- dasdasd sadasd sad', { channel: '#foo' }) get_replies(msg) - msg = make_message(@bot, '!karma foo', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo is -1" + msg = make_message(@bot, '!karma foo', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo is -1') end it 'should allow users to remove karma with items with spaces via ()' do - msg = make_message(@bot, '(foo bar)--', { :channel => '#foo' }) + msg = make_message(@bot, '(foo bar)--', { channel: '#foo' }) get_replies(msg) - msg = make_message(@bot, '!karma foo bar', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo bar is -1" + msg = make_message(@bot, '!karma foo bar', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo bar is -1') end it 'should not allow users to check karam via pm' do msg = make_message(@bot, '!karma foo') - get_replies(msg).first.text.should == "You must use that command in the main channel." + expect(get_replies(msg).first.text) + .to eq('You must use that command in the main channel.') end it 'should not allow users to add karma via pm' do msg = make_message(@bot, 'foo++') - msg = make_message(@bot, '!karma foo', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo is 0" + msg = make_message(@bot, '!karma foo', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo is 0') end it 'should not allow users to remove karma via pm' do msg = make_message(@bot, 'foo--') - msg = make_message(@bot, '!karma foo', { :channel => '#foo' }) - get_replies(msg).first.text.should == "Karma for foo is 0" + msg = make_message(@bot, '!karma foo', { channel: '#foo' }) + expect(get_replies(msg).first.text) + .to eq('Karma for foo is 0') end end