m-spec 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +14 -0
- data/exe/m-spec +8 -4
- data/lib/m-spec/core/helpers/readable.rb +1 -2
- data/lib/m-spec/core/matchers/output.rb +1 -1
- data/lib/m-spec/mocks/allow.rb +1 -1
- data/lib/m-spec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40b2437fce4d14eb4337f07a9d3f9ee43a9f6dc27591c19c4efadf53d05d83f3
|
4
|
+
data.tar.gz: 973c37628137445b7fbb1d0645bd657bfa6c6da14ee57426307f4bf0f0dfe3ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b69cdb674edf1cfc47ffb60c50d6fc6996f3ee49a60211f7941bc697f896514e9c3f62ef8fe77a346371fb2d1c61a830c0b8d792c9fd7bbb4716116efa09da7
|
7
|
+
data.tar.gz: c12a16300c6fcbb25ac84e5ade3d05ba57f2f830899b78ecbdc2e4ea62b62c80be6c99746130f116b15244a5575613b879444cb4050d21b1da8ca6e98583cebc
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -18,6 +18,14 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install m-spec
|
20
20
|
|
21
|
+
## Setup
|
22
|
+
|
23
|
+
Initialize m-spec with a `.m-spec` and a `.rubocop.yml` file
|
24
|
+
```sh
|
25
|
+
m-spec --init
|
26
|
+
```
|
27
|
+
|
28
|
+
|
21
29
|
## Usage
|
22
30
|
|
23
31
|
We care about isolating unit tests, so there's a very simple mocking library.
|
@@ -54,6 +62,12 @@ describe 'test doubles' do
|
|
54
62
|
allow(mock).to receive(:speak) { 'Hello!' }
|
55
63
|
expect(mock.speak).to eq 'Hello!'
|
56
64
|
end
|
65
|
+
|
66
|
+
it 'can be sent messages with any args' do
|
67
|
+
mock = test_double('a name')
|
68
|
+
allow(mock).to receive(:speak) { 'Hello!' }
|
69
|
+
expect(mock.speak('example arg')).to eq 'Hello!'
|
70
|
+
end
|
57
71
|
end
|
58
72
|
|
59
73
|
describe 'testing output' do
|
data/exe/m-spec
CHANGED
@@ -3,11 +3,12 @@ require 'm-spec'
|
|
3
3
|
|
4
4
|
def run_rubocop!
|
5
5
|
# needs default
|
6
|
-
if File.
|
6
|
+
if File.exist?('.rubocop.yml')
|
7
7
|
puts "\n---Readability Tests---\n\n"
|
8
8
|
system("bundle exec rubocop")
|
9
9
|
else
|
10
|
-
puts "ERROR: No '.rubocop.yml' found, please create one at your project
|
10
|
+
puts "ERROR: No '.rubocop.yml' found, please create one at your project \
|
11
|
+
root or re-initialize m-spec with `m-spec --init`"
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -23,12 +24,15 @@ if ARGV[0] == '--init'
|
|
23
24
|
end
|
24
25
|
puts 'created: .rubocop.yml'
|
25
26
|
|
26
|
-
contents =
|
27
|
+
contents =
|
28
|
+
"# This has been auto-generated. Feel free to delete these comments.\
|
29
|
+
\n#\n# Try adding options below: '--no-rubocop' or '--only-rubocop' \
|
30
|
+
without the quotes."
|
27
31
|
File.open('.m-spec', 'w') do |file|
|
28
32
|
file.write(contents)
|
29
33
|
end
|
30
34
|
puts 'created: .m-spec'
|
31
|
-
elsif File.
|
35
|
+
elsif File.exist?('./.m-spec')
|
32
36
|
File.open('./.m-spec', 'r') do |file|
|
33
37
|
options = file.read.split
|
34
38
|
if options.include?('--only-rubocop')
|
@@ -12,7 +12,6 @@ end
|
|
12
12
|
def it(str, specs = Mspec::Specs.instance)
|
13
13
|
spec_example = Mspec::SpecExample.new(str, yield)
|
14
14
|
specs.add(spec_example)
|
15
|
-
|
16
15
|
if spec_example.success?
|
17
16
|
puts " \e[#{COLOUR_CODES[:green]}m#{str}\e[0m"
|
18
17
|
else
|
@@ -24,7 +23,7 @@ def it(str, specs = Mspec::Specs.instance)
|
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
def expect(obj=nil, &block)
|
26
|
+
def expect(obj = nil, &block)
|
28
27
|
if !obj.nil?
|
29
28
|
Mspec::Expect.new(obj)
|
30
29
|
else
|
data/lib/m-spec/mocks/allow.rb
CHANGED
data/lib/m-spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: m-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edward Withers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|