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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eace20929823a4580fbe403cd2b5dd9a96951ba95f10b975021c3840806bd3c0
4
- data.tar.gz: 8b21a70b0002c89d6171aa73b1c17bbd5ff802ec57420f7034fbc2cdc1029b1e
3
+ metadata.gz: 40b2437fce4d14eb4337f07a9d3f9ee43a9f6dc27591c19c4efadf53d05d83f3
4
+ data.tar.gz: 973c37628137445b7fbb1d0645bd657bfa6c6da14ee57426307f4bf0f0dfe3ae
5
5
  SHA512:
6
- metadata.gz: '081d965bf4644e94d2f536bd3627c7e91ba1d7409342fa16387896116906f174ed75e4ba8e1d8725b8980d144b713aeae724bb64e80fd6a74a3cfbb5bf937398'
7
- data.tar.gz: 01c5e3960b267b2aba92854c143251cc49d6018b30eda73a51d2bcf139e2ec25484035bc0c104254c9b2e4705043d2b99259de0562a58fbe37a9af816c2678d0
6
+ metadata.gz: 1b69cdb674edf1cfc47ffb60c50d6fc6996f3ee49a60211f7941bc697f896514e9c3f62ef8fe77a346371fb2d1c61a830c0b8d792c9fd7bbb4716116efa09da7
7
+ data.tar.gz: c12a16300c6fcbb25ac84e5ade3d05ba57f2f830899b78ecbdc2e4ea62b62c80be6c99746130f116b15244a5575613b879444cb4050d21b1da8ca6e98583cebc
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in mspec.gemspec
6
6
  gemspec
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.exists?('.rubocop.yml')
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 root or re-initialize m-spec with `m-spec --init`"
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 = "# This has been auto-generated. Feel free to delete these comments.\n#\n# Try adding options below: '--no-rubocop' or '--only-rubocop' without the quotes."
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.exists?('./.m-spec')
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
@@ -20,7 +20,7 @@ module Mspec
20
20
 
21
21
  private
22
22
 
23
- def mock_output(output=StringIO.new, &block)
23
+ def mock_output(output = StringIO.new, &block)
24
24
  $stdout = output
25
25
  block.call
26
26
  $stdout = STDOUT
@@ -6,7 +6,7 @@ module Mspec
6
6
  end
7
7
 
8
8
  def to(stub)
9
- @obj.define_singleton_method(stub.name) { stub.return_value }
9
+ @obj.define_singleton_method(stub.name) { |*| stub.return_value }
10
10
  end
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module Mspec
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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.1
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-13 00:00:00.000000000 Z
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop