aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Doits <markus.doits@stellenticket.de>2016-09-11 13:59:30 +0200
committerMarkus Doits <markus.doits@stellenticket.de>2016-09-11 13:59:30 +0200
commit2add678227641788598b6df1c29ae492fb384482 (patch)
treea4427ea2452f782fd82cbe1e5c2ea6851ad112bd
parent2950a68a415c97c4459a4df9a1556daccd29296e (diff)
downloadpronto-hlint-2add678227641788598b6df1c29ae492fb384482.tar.gz
pronto-hlint-2add678227641788598b6df1c29ae492fb384482.tar.zst
pronto-hlint-2add678227641788598b6df1c29ae492fb384482.zip
change rspec syntax to expect
-rw-r--r--spec/pronto/eslint_spec.rb30
-rw-r--r--spec/spec_helper.rb6
2 files changed, 24 insertions, 12 deletions
diff --git a/spec/pronto/eslint_spec.rb b/spec/pronto/eslint_spec.rb
index 63d0d68..2065998 100644
--- a/spec/pronto/eslint_spec.rb
+++ b/spec/pronto/eslint_spec.rb
@@ -5,16 +5,22 @@ module Pronto
5 let(:eslint) { ESLintNpm.new(patches) } 5 let(:eslint) { ESLintNpm.new(patches) }
6 6
7 describe '#run' do 7 describe '#run' do
8 subject { eslint.run } 8 subject(:run) { eslint.run }
9 9
10 context 'patches are nil' do 10 context 'patches are nil' do
11 let(:patches) { nil } 11 let(:patches) { nil }
12 it { should == [] } 12
13 it 'returns an empty array' do
14 expect(run).to eql([])
15 end
13 end 16 end
14 17
15 context 'no patches' do 18 context 'no patches' do
16 let(:patches) { [] } 19 let(:patches) { [] }
17 it { should == [] } 20
21 it 'returns an empty array' do
22 expect(run).to eql([])
23 end
18 end 24 end
19 25
20 context 'patches with a one and a four warnings' do 26 context 'patches with a one and a four warnings' do
@@ -22,8 +28,13 @@ module Pronto
22 28
23 let(:patches) { repo.diff('master') } 29 let(:patches) { repo.diff('master') }
24 30
25 its(:count) { should == 5 } 31 it 'returns correct number of errors' do
26 its(:'first.msg') { should == "'foo' is not defined." } 32 expect(run.count).to eql(5)
33 end
34
35 it 'has correct first message' do
36 expect(run.first.msg).to eql("'foo' is not defined.")
37 end
27 end 38 end
28 39
29 context 'repo with ignored and not ignored file, each with three warnings' do 40 context 'repo with ignored and not ignored file, each with three warnings' do
@@ -31,8 +42,13 @@ module Pronto
31 42
32 let(:patches) { repo.diff('master') } 43 let(:patches) { repo.diff('master') }
33 44
34 its(:count) { should == 3 } 45 it 'returns correct number of errors' do
35 its(:'first.msg') { should == "'HelloWorld' is defined but never used." } 46 expect(run.count).to eql(3)
47 end
48
49 it 'has correct first message' do
50 expect(run.first.msg).to eql("'HelloWorld' is defined but never used.")
51 end
36 end 52 end
37 end 53 end
38 end 54 end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 23f22e8..72a128b 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,4 @@
1require 'fileutils'
1require 'rspec' 2require 'rspec'
2require 'rspec/its' 3require 'rspec/its'
3require 'pronto/eslint_npm' 4require 'pronto/eslint_npm'
@@ -12,8 +13,3 @@ require 'pronto/eslint_npm'
12 after { FileUtils.mv(dot_git, git) } 13 after { FileUtils.mv(dot_git, git) }
13 end 14 end
14end 15end
15
16RSpec.configure do |config|
17 config.expect_with(:rspec) { |c| c.syntax = :should }
18 config.mock_with(:rspec) { |c| c.syntax = :should }
19end