sinclair 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4f1722c4f4642983d8bffccddbac5dc76a18b592
4
- data.tar.gz: 943f6a96fab30c1eb6d191a7948b69581c079099
2
+ SHA256:
3
+ metadata.gz: ac0a266d5bf3934653eeb107bc0e7305bfffb80b1845be7abe617aef8b910be6
4
+ data.tar.gz: 978c830d6045dc169d426f07a79e96bdafbd25482ca982636c8244d3348d69e8
5
5
  SHA512:
6
- metadata.gz: 93744c9aafc218ca2f0a26b767f620c6e7c14362601ab26a113ad238345b6e6e6d92558ee6e1dd0b5c40c1b463e9370954b680d7f8f91a05b1253fc9cdbaaeac
7
- data.tar.gz: dfbf362cbdd528984e72e2d066e14be6bd9ca3eeddc9cff339fe7c9809617c17761ada63792f383f0ea3b8e1d13397af912b872c42eb542cca0a089f4e1d8a4b
6
+ metadata.gz: c62398491d7d08baa0134e5a5bbe0bfc7b964e2deb2e2c2f25db63788069c654d2636d07aa52ed1f653ee9ba9395f70425d5ab58116447f705ff2b54d0e4273e
7
+ data.tar.gz: a8642cb8a8aaafab6c5ef20663f02bcb7ee629900f463f3dc385e3c27cf3ef8c272221987fac9b6cf26c165ad07e0fa9710fcb1d3fa884d94fabaa9c3602e3d7
@@ -2,13 +2,27 @@ version: 2
2
2
  jobs:
3
3
  build:
4
4
  docker:
5
- - image: circleci/ruby:2.4.1
5
+ - image: darthjee/circleci_ruby_gems:0.0.1
6
6
  steps:
7
7
  - checkout
8
- - run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
- - run: chmod +x ./cc-test-reporter
10
- - run: ./cc-test-reporter before-build
11
- - run: bundle install
12
- - run: bundle exec rspec
13
- - run: rubocop
14
- - run: ./cc-test-reporter after-build --exit-code $?
8
+ - run:
9
+ name: Prepare Coverage Test Report
10
+ command: cc-test-reporter before-build
11
+ - run:
12
+ name: Bundle Install
13
+ command: bundle install
14
+ - run:
15
+ name: RSpec
16
+ command: bundle exec rspec
17
+ - run:
18
+ name: Rubocop
19
+ command: rubocop
20
+ - run:
21
+ name: Coverage Test Report
22
+ command: cc-test-reporter after-build --exit-code $?
23
+ - run:
24
+ name: Yardstick coverage check
25
+ command: bundle exec rake verify_measurements
26
+ - run:
27
+ name: Check version documentation
28
+ command: scripts/check_readme.sh
data/.gitignore CHANGED
@@ -4,3 +4,5 @@ Gemfile.lock
4
4
  coverage
5
5
  doc
6
6
  .yardoc/
7
+ measurement/
8
+ **/*.swp
@@ -0,0 +1,6 @@
1
+ FROM darthjee/ruby_gems:0.0.1
2
+
3
+ USER app
4
+ COPY --chown=app ./ /home/app/app/
5
+
6
+ RUN bundle install
data/README.md CHANGED
@@ -29,7 +29,7 @@ Installation
29
29
 
30
30
  Yard Documentation
31
31
  -------------------
32
- https://www.rubydoc.info/gems/sinclair/
32
+ https://www.rubydoc.info/gems/sinclair/1.1.3
33
33
 
34
34
  Usage
35
35
  ---------------
@@ -131,7 +131,7 @@ adding methods to your class or by extending it for more complex logics
131
131
  ```surname``` ```surname=``` ```surname_valid?```
132
132
  ```age``` ```age=``` ```age_valid?```
133
133
  ```legs``` ```legs=``` ```legs_valid?```
134
- ```valid?```
134
+ ```valid?```.
135
135
 
136
136
  ```ruby
137
137
 
@@ -181,6 +181,7 @@ You can use the provided matcher to check that your builder is adding a method c
181
181
  end
182
182
  end
183
183
 
184
+ require 'sinclair/matchers'
184
185
  RSpec.configure do |config|
185
186
  config.include Sinclair::Matchers
186
187
  end
data/Rakefile CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
+ require 'yardstick/rake/measurement'
6
+ require './config/yardstick'
7
+
8
+ RSpec::Core::RakeTask.new
5
9
 
6
10
  task default: :spec
7
11
  task test: :spec
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yardstick/rake/measurement'
4
+ require 'yardstick/rake/verify'
5
+ require 'yaml'
6
+
7
+ options = YAML.load_file('config/yardstick.yml')
8
+
9
+ Yardstick::Rake::Measurement.new(:yardstick_measure, options) do |measurement|
10
+ measurement.output = 'measurement/report.txt'
11
+ end
12
+
13
+ Yardstick::Rake::Verify.new(:verify_measurements, options)
@@ -0,0 +1,54 @@
1
+ threshold: 100
2
+ require_exact_threshold: false
3
+ rules:
4
+ ApiTag::Presence:
5
+ enabled: true
6
+ exclude: []
7
+ ApiTag::Inclusion:
8
+ enabled: true
9
+ exclude: []
10
+ ApiTag::ProtectedMethod:
11
+ enabled: true
12
+ exclude: []
13
+ ApiTag::PrivateMethod:
14
+ enabled: true
15
+ exclude: []
16
+ ExampleTag:
17
+ enabled: true
18
+ exclude:
19
+ - Sinclair::OptionsParser#options
20
+ - Sinclair::OptionsParser#options_object
21
+ ReturnTag:
22
+ enabled: true
23
+ exclude:
24
+ - Sinclair#klass
25
+ - Sinclair::Matchers::AddMethod#method
26
+ - Sinclair::Matchers::AddMethodTo#method
27
+ - Sinclair::Matchers::AddMethodTo#instance
28
+ - Sinclair::MethodDefinition#name
29
+ - Sinclair::MethodDefinition#code
30
+ - Sinclair::MethodDefinition#block
31
+ - Sinclair::OptionsParser#options
32
+ - Sinclair::OptionsParser#options_object
33
+ - Sinclair::Matchers::AddMethodTo#raise_block_syntax_error
34
+ Summary::Presence:
35
+ enabled: true
36
+ exclude:
37
+ - Sinclair#klass
38
+ - Sinclair::Matchers::AddMethod#method
39
+ - Sinclair::Matchers::AddMethodTo#method
40
+ - Sinclair::Matchers::AddMethodTo#instance
41
+ - Sinclair::MethodDefinition#name
42
+ - Sinclair::MethodDefinition#code
43
+ - Sinclair::MethodDefinition#block
44
+ - Sinclair::OptionsParser#options
45
+ - Sinclair::OptionsParser#options_object
46
+ Summary::Length:
47
+ enabled: true
48
+ exclude: []
49
+ Summary::Delimiter:
50
+ enabled: true
51
+ exclude: []
52
+ Summary::SingleLine:
53
+ enabled: true
54
+ exclude: []
@@ -1,18 +1,23 @@
1
- version: '2'
1
+ version: '3'
2
2
  services:
3
3
  base: &base
4
- image: ruby:2.4.0
5
- working_dir: /home/app/sinclair
4
+ image: sinclair
5
+ working_dir: /home/app/app
6
6
  volumes:
7
- - .:/home/app/sinclair
8
- - sinclair_gems_2_4_0:/usr/local/bundle
7
+ - .:/home/app/app
9
8
 
10
- #################### CONTAINERS ####################
9
+ base_build:
10
+ <<: *base
11
+ build: .
12
+ command: echo done
11
13
 
12
14
  sinclair:
13
15
  <<: *base
14
16
  container_name: sinclair
15
- command: /bin/bash -c 'bundle install && bundle exec rspec'
17
+ depends_on: [base_build]
18
+ command: /bin/bash -c 'rspec'
16
19
 
17
- volumes:
18
- sinclair_gems_2_4_0:
20
+ test_all:
21
+ <<: *base
22
+ depends_on: [base_build]
23
+ command: /bin/bash -c 'rspec && yard && rake yardstick_measure && rake verify_measurements'
@@ -3,10 +3,12 @@
3
3
  require 'active_support'
4
4
  require 'active_support/all'
5
5
 
6
+ # @api public
7
+ # @author darthjee
8
+ #
6
9
  # Builder that add instance methods to a class
7
10
  #
8
11
  # @example
9
- #
10
12
  # class MyModel
11
13
  # end
12
14
  #
@@ -27,10 +29,11 @@ class Sinclair
27
29
 
28
30
  autoload :VERSION, 'sinclair/version'
29
31
  autoload :MethodDefinition, 'sinclair/method_definition'
30
- autoload :Matchers, 'sinclair/matchers'
31
32
 
32
33
  include OptionsParser
33
34
 
35
+ # Returns a new instance of Sinclair
36
+ #
34
37
  # @param klass [Class] to receive the methods
35
38
  # @param options [Hash] open hash options to be used by builders inheriting from Sinclair
36
39
  # through the Sinclair::OptionsParser concern
@@ -70,6 +73,8 @@ class Sinclair
70
73
  # builder.build
71
74
  #
72
75
  # MyModel.new.respond_to(:default_value) # returns true
76
+ #
77
+ # @return [Array<MethodDefinition>]
73
78
  def build
74
79
  definitions.each do |definition|
75
80
  definition.build(klass)
@@ -79,42 +84,41 @@ class Sinclair
79
84
  # add a method to the method list to be created on klass
80
85
  #
81
86
  # @overload add_method(name, code)
82
- # @param name [String/Symbol] name of the method to be added
87
+ # @param name [String,Symbol] name of the method to be added
83
88
  # @param code [String] code to be evaluated when the method is ran
84
89
  #
85
- # @example
86
- # class Person
87
- # attr_reader :first_name, :last_name
90
+ # @example Using string code
91
+ # class Person
92
+ # attr_reader :first_name, :last_name
88
93
  #
89
- # def initialize(first_name, last_name)
90
- # @first_name = first_name
91
- # @last_name = last_name
92
- # end
94
+ # def initialize(first_name, last_name)
95
+ # @first_name = first_name
96
+ # @last_name = last_name
93
97
  # end
98
+ # end
94
99
  #
95
- # builder = Sinclair.new(Person)
96
- # builder.add_method(:full_name, '[first_name, last_name].join(" ")')
97
- # builder.build
100
+ # builder = Sinclair.new(Person)
101
+ # builder.add_method(:full_name, '[first_name, last_name].join(" ")')
102
+ # builder.build
98
103
  #
99
- # Person.new('john', 'wick').full_name # returns 'john wick'
104
+ # Person.new('john', 'wick').full_name # returns 'john wick'
100
105
  #
101
106
  # @overload add_method(name, &block)
102
- # @param name [String/Symbol] name of the method to be added
107
+ # @param name [String,Symbol] name of the method to be added
103
108
  # @param block [Proc] block to be ran as method
104
109
  #
105
- # @example
106
- #
107
- # builder = Sinclair.new(Person)
108
- # builder.add_method(:bond_name) { "#{last_name}, #{full_name}" }
109
- # builder.build
110
+ # @example Using block
111
+ # builder = Sinclair.new(Person)
112
+ # builder.add_method(:bond_name) { "#{last_name}, #{full_name}" }
113
+ # builder.build
110
114
  #
111
- # Person.new('john', 'wick').bond_name # returns 'wick, john wick'
115
+ # Person.new('john', 'wick').bond_name # returns 'wick, john wick'
116
+ # @return [Array<MethodDefinition>]
112
117
  def add_method(name, code = nil, &block)
113
118
  definitions << MethodDefinition.new(name, code, &block)
114
119
  end
115
120
 
116
- # evaluetes a block which will result in a [String] to be
117
- # then used as code for the method
121
+ # Evaluetes a block which will result in a String, the method code
118
122
  #
119
123
  # @example
120
124
  #
@@ -183,14 +187,24 @@ class Sinclair
183
187
  # end
184
188
  #
185
189
  # Purchase.new(2.3, 5).total_price # returns 11.5
190
+ # @return [Array<MethodDefinition>]
186
191
  def eval_and_add_method(name, &block)
187
192
  add_method(name, instance_eval(&block))
188
193
  end
189
194
 
190
195
  private
191
196
 
197
+ # @api private
198
+ # @private
192
199
  attr_reader :klass
193
200
 
201
+ # @private
202
+ #
203
+ # @api private
204
+ #
205
+ # List of mthod definitions
206
+ #
207
+ # @return [Array<MethodDefinition>]
194
208
  def definitions
195
209
  @definitions ||= []
196
210
  end
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Sinclair
4
+ # @api public
5
+ # @author darthjee
6
+ #
4
7
  # Matchers module will have the DSL to be included in RSpec in order to have
5
8
  # access to the matchers
6
9
  #
@@ -29,6 +32,10 @@ class Sinclair
29
32
  autoload :AddMethodTo, 'sinclair/matchers/add_method_to'
30
33
 
31
34
  # DSL to AddMethod
35
+ #
36
+ # @example (see Sinclair::Matchers)
37
+ # @example (see Sinclair::Matchers::AddMethod#to)
38
+ #
32
39
  # @return [AddMethod] RSpec Matcher
33
40
  def add_method(method)
34
41
  Sinclair::Matchers::AddMethod.new(method)
@@ -2,21 +2,33 @@
2
2
 
3
3
  class Sinclair
4
4
  module Matchers
5
+ # @author darthjee
5
6
  # AddMethod is able to build an instance of Sinclair::Matchers::AddMethodTo
6
7
  class AddMethod < RSpec::Matchers::BuiltIn::BaseMatcher
7
- # as any matcher is expected to implement matches?, we raise a warning on
8
- # the usage as this is only a builder for AddMethodTo
8
+ # @api private
9
+ # @abstract
10
+ #
11
+ # Raise a warning on the usage as this is only a builder for AddMethodTo
12
+ #
13
+ # @raise SyntaxError
9
14
  def matches?(_actual)
10
15
  raise SyntaxError, 'You should specify which instance the method is being added to' \
11
16
  "add_method(:#{method}).to(instance)"
12
17
  end
13
18
 
14
- # @param method [String/Symbol] the method, to be checked, name
19
+ # @api private
20
+ #
21
+ # Returns a new instance of AddMethod
22
+ #
23
+ # @param method [String,Symbol] the method, to be checked, name
15
24
  def initialize(method)
16
25
  @method = method
17
26
  end
18
27
 
19
- # @return [AddMethodTo] the correct matcher
28
+ # @api public
29
+ #
30
+ # Creates a matcher AddMethodTo
31
+ #
20
32
  # @overload to(klass)
21
33
  # @param [Class] klass
22
34
  # class where the method should be added to
@@ -24,22 +36,71 @@ class Sinclair
24
36
  # @overload to(instance)
25
37
  # @param [Object] instance
26
38
  # instance of the class where the method should be added to
39
+ #
40
+ # @example Using inside RSpec and checking Class
41
+ # RSpec.describe "MyBuilder" do
42
+ # let(:clazz) { Class.new }
43
+ # let(:builder) { Sinclair.new(clazz) }
44
+ #
45
+ # before do
46
+ # builder.add_method(:new_method, "2")
47
+ # end
48
+ #
49
+ # it do
50
+ # expect { builder.build }.to add_method(:new_method).to(clazz)
51
+ # end
52
+ # end
53
+ #
54
+ # # Outputs
55
+ # # 'should add method 'new_method' to #<Class:0x000056441bf46608> instances'
56
+ # @example Using inside RSpec and checking instance
57
+ # RSpec.describe "MyBuilder" do
58
+ # let(:clazz) { Class.new }
59
+ # let(:builder) { Sinclair.new(clazz) }
60
+ # let(:instance) { clazz.new }
61
+ #
62
+ # before do
63
+ # builder.add_method(:the_method, "true")
64
+ # end
65
+ #
66
+ # it do
67
+ # expect { builder.build }.to add_method(:the_method).to(instance)
68
+ # end
69
+ # end
70
+ #
71
+ # # Outputs
72
+ # # 'should add method 'the_method' to #<Class:0x000056441bf46608> instances'
73
+ #
74
+ # @return [AddMethodTo] the correct matcher
27
75
  def to(target = nil)
28
76
  AddMethodTo.new(target, method)
29
77
  end
30
78
 
79
+ # @api private
80
+ #
81
+ # definition needed for block matchers
82
+ #
83
+ # @return [Boolean]
84
+ def supports_block_expectations?
85
+ true
86
+ end
87
+
88
+ # @api private
89
+ #
90
+ # Checkes if another instnce is equal self
91
+ #
92
+ # @return [Boolean]
31
93
  def equal?(other)
32
94
  return unless other.class == self.class
33
95
  other.method == method
34
96
  end
35
97
 
36
- # definition needed for block matchers
37
- def supports_block_expectations?
38
- true
39
- end
98
+ alias == equal?
40
99
 
41
100
  protected
42
101
 
102
+ # @api private
103
+ # @private
43
104
  attr_reader :method
44
105
  end
45
106
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  class Sinclair
4
4
  module Matchers
5
+ # @api private
6
+ # @author darthjee
7
+ #
5
8
  # AddMethodTo checks whether a method was or not added by the call of a block
6
9
  #
7
10
  # This is used with a RSpec DSL method add_method(method_name).to(class_object)
@@ -29,6 +32,10 @@ class Sinclair
29
32
  # end
30
33
  # end
31
34
  class AddMethodTo < RSpec::Matchers::BuiltIn::BaseMatcher
35
+ # @private
36
+ #
37
+ # Returns a new instance of AddMethodTo
38
+ #
32
39
  # @overload initialize(klass, method)
33
40
  # @param [Class] klass
34
41
  # class where the method should be added to
@@ -48,22 +55,38 @@ class Sinclair
48
55
  @method = method
49
56
  end
50
57
 
51
- # @return [String] expectation description
58
+ # @private
59
+ #
60
+ # Returnst expectaton description
61
+ #
62
+ # @return [String]
52
63
  def description
53
64
  "add method '#{method}' to #{klass} instances"
54
65
  end
55
66
 
56
- # @return [String] message on expectation failure
67
+ # @private
68
+ #
69
+ # Returns message on expectation failure
70
+ #
71
+ # @return [String]
57
72
  def failure_message_for_should
58
73
  "expected '#{method}' to be added to #{klass} but " \
59
74
  "#{@initial_state ? 'it already existed' : "it didn't"}"
60
75
  end
61
76
 
62
- # @return [String] message on expectation failure for negative expectation
77
+ # @private
78
+ #
79
+ # Returns message on expectation failure for negative expectation
80
+ #
81
+ # @return [String]
63
82
  def failure_message_for_should_not
64
83
  "expected '#{method}' not to be added to #{klass} but it was"
65
84
  end
66
85
 
86
+ # @private
87
+ #
88
+ # Checks if expectation is true or not
89
+ #
67
90
  # @return [Boolean] expectation check
68
91
  def matches?(event_proc)
69
92
  return false unless event_proc.is_a?(Proc)
@@ -77,36 +100,72 @@ class Sinclair
77
100
  true
78
101
  end
79
102
 
103
+ # @api private
104
+ #
105
+ # Checkes if another instnce is equal self
106
+ #
107
+ # @return [Boolean]
80
108
  def equal?(other)
81
109
  return unless other.class == self.class
82
110
  other.method == method &&
83
111
  other.instance == instance
84
112
  end
85
113
 
114
+ alias == equal?
115
+ alias failure_message failure_message_for_should
116
+ alias failure_message_when_negated failure_message_for_should_not
117
+
86
118
  protected
87
119
 
120
+ # @api private
121
+ # @private
88
122
  attr_reader :method, :instance
89
123
 
90
124
  private
91
125
 
126
+ # @private
127
+ #
128
+ # Checks if a method was added (didn't exist before)
129
+ #
130
+ # @return Boolean
92
131
  def added?
93
132
  !@initial_state && @final_state
94
133
  end
95
134
 
135
+ # @private
136
+ #
137
+ # Call block to check if it aded a method or not
138
+ #
139
+ # @return [Boolan]
96
140
  def perform_change(event_proc)
97
141
  @initial_state = method_defined?
98
142
  event_proc.call
99
143
  @final_state = method_defined?
100
144
  end
101
145
 
146
+ # @private
147
+ #
148
+ # Checks if class has instance method defined
149
+ #
150
+ # @return [Boolean]
102
151
  def method_defined?
103
152
  klass.method_defined?(method)
104
153
  end
105
154
 
155
+ # @private
156
+ #
157
+ # Class to be analised
158
+ #
159
+ # @return [Class]
106
160
  def klass
107
161
  @klass ||= instance.class
108
162
  end
109
163
 
164
+ # @private
165
+ #
166
+ # Raises when block was not given
167
+ #
168
+ # @raise SyntaxError
110
169
  def raise_block_syntax_error
111
170
  raise SyntaxError, 'Block not received by the `add_method_to` matcher. ' \
112
171
  'Perhaps you want to use `{ ... }` instead of do/end?'
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Sinclair
4
+ # @api private
5
+ # @author darthjee
6
+ #
4
7
  # Definition of the code or block to be aded as method
5
8
  class MethodDefinition
9
+ # Returns a new instance of MethodDefinition
10
+ #
6
11
  # @overload initialize(name, code)
7
12
  # @overload initialize(name, &block)
8
13
  #
9
- # @param name [String/Symbol] name of the method
14
+ # @param name [String,Symbol] name of the method
10
15
  # @param code [String] code to be evaluated as method
11
16
  # @param block [Proc] block with code to be added as method
12
17
  #
@@ -22,7 +27,10 @@ class Sinclair
22
27
  end
23
28
 
24
29
  # Adds the method to given klass
30
+ #
25
31
  # @param klass [Class] class which will receive the new method
32
+ #
33
+ # @return [Symbol] name of the created method
26
34
  def build(klass)
27
35
  if code.is_a?(String)
28
36
  build_code_method(klass)
@@ -33,16 +41,32 @@ class Sinclair
33
41
 
34
42
  private
35
43
 
44
+ # @private
36
45
  attr_reader :name, :code, :block
37
46
 
47
+ # @private
48
+ #
49
+ # Add method from block
50
+ #
51
+ # @return [Symbol] name of the created method
38
52
  def build_block_method(klass)
39
53
  klass.send(:define_method, name, block)
40
54
  end
41
55
 
56
+ # @private
57
+ #
58
+ # Add method from String code
59
+ #
60
+ # @return [Symbol] name of the created method
42
61
  def build_code_method(klass)
43
62
  klass.module_eval(code_definition, __FILE__, __LINE__ + 1)
44
63
  end
45
64
 
65
+ # @private
66
+ #
67
+ # Builds full code of method
68
+ #
69
+ # @return [String]
46
70
  def code_definition
47
71
  <<-CODE
48
72
  def #{name}
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Sinclair
4
+ # @api public
5
+ #
6
+ # @author darthjee
7
+ #
4
8
  # Concern for easily adding options
5
9
  #
6
10
  # @example
@@ -28,8 +32,14 @@ class Sinclair
28
32
 
29
33
  private
30
34
 
35
+ # @!visibility public
31
36
  attr_reader :options
32
37
 
38
+ # @!visibility public
39
+ #
40
+ # Builds an openstruct of the Hash
41
+ #
42
+ # @return [OpenStruct]
33
43
  def options_object
34
44
  @options_object ||= OpenStruct.new options
35
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Sinclair
4
- VERSION = '1.1.2'
4
+ VERSION = '1.1.3'
5
5
  end
@@ -0,0 +1,6 @@
1
+ #! /bin/bash
2
+
3
+ PROJECT=sinclair
4
+ VERSION=$(grep VERSION lib/$PROJECT/version.rb | sed -e "s/.*'\(.*\)'/\1/g")
5
+
6
+ grep https://www.rubydoc.info/gems/$PROJECT/$VERSION README.md
@@ -21,11 +21,13 @@ Gem::Specification.new do |gem|
21
21
 
22
22
  gem.add_runtime_dependency 'activesupport', '~> 5.2.0'
23
23
 
24
- gem.add_development_dependency 'bundler', '~> 1.6'
25
- gem.add_development_dependency 'pry-nav'
26
- gem.add_development_dependency 'rake', '~> 12.0.0'
27
- gem.add_development_dependency 'rspec', '~> 2.14'
28
- gem.add_development_dependency 'rubocop'
29
- gem.add_development_dependency 'simplecov', '~> 0.16.1'
30
- gem.add_development_dependency 'yard'
24
+ gem.add_development_dependency 'bundler', '~> 1.16.1'
25
+ gem.add_development_dependency 'pry-nav', '~> 0.2.4'
26
+ gem.add_development_dependency 'rake', '>= 12.3.1'
27
+ gem.add_development_dependency 'rspec', '>= 3.8'
28
+ gem.add_development_dependency 'rubocop', '0.58.1'
29
+ gem.add_development_dependency 'rubocop-rspec', '1.30.0'
30
+ gem.add_development_dependency 'simplecov', '~> 0.16.x'
31
+ gem.add_development_dependency 'yard', '>= 0.9.18'
32
+ gem.add_development_dependency 'yardstick', '>= 0.9.9'
31
33
  end
@@ -33,6 +33,7 @@ describe 'matchers' do
33
33
  before do
34
34
  block.call
35
35
  end
36
+
36
37
  it 'raises expectation error' do
37
38
  expect { expectation }.to raise_error(
38
39
  RSpec::Expectations::ExpectationNotMetError,
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Sinclair::Matchers::AddMethod do
6
+ describe 'yard' do
7
+ describe '#to' do
8
+ context 'checking against Class' do
9
+ let(:clazz) { Class.new }
10
+ let(:builder) { Sinclair.new(clazz) }
11
+
12
+ before do
13
+ builder.add_method(:new_method, '2')
14
+ end
15
+
16
+ it do
17
+ expect { builder.build }.to add_method(:new_method).to(clazz)
18
+ end
19
+ end
20
+
21
+ context 'checking against instance' do
22
+ let(:clazz) { Class.new }
23
+ let(:builder) { Sinclair.new(clazz) }
24
+ let(:instance) { clazz.new }
25
+
26
+ before do
27
+ builder.add_method(:the_method, 'true')
28
+ end
29
+
30
+ it do
31
+ expect { builder.build }.to add_method(:the_method).to(instance)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -9,6 +9,7 @@ end
9
9
  SimpleCov.start 'gem'
10
10
 
11
11
  require 'sinclair'
12
+ require 'sinclair/matchers'
12
13
  require 'pry-nav'
13
14
 
14
15
  support_files = File.expand_path('spec/support/**/*.rb')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinclair
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - DarthJee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-10 00:00:00.000000000 Z
11
+ date: 2019-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,98 +30,126 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.6'
33
+ version: 1.16.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.6'
40
+ version: 1.16.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry-nav
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.2.4
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.2.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 12.0.0
61
+ version: 12.3.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 12.0.0
68
+ version: 12.3.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '2.14'
75
+ version: '3.8'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '2.14'
82
+ version: '3.8'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.58.1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.58.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
95
102
  - !ruby/object:Gem::Version
96
- version: '0'
103
+ version: 1.30.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.30.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: simplecov
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: 0.16.1
117
+ version: 0.16.x
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: 0.16.1
124
+ version: 0.16.x
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: yard
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
116
130
  - !ruby/object:Gem::Version
117
- version: '0'
131
+ version: 0.9.18
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 0.9.18
139
+ - !ruby/object:Gem::Dependency
140
+ name: yardstick
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 0.9.9
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
150
  - - ">="
123
151
  - !ruby/object:Gem::Version
124
- version: '0'
152
+ version: 0.9.9
125
153
  description: Gem for easy concern creation
126
154
  email:
127
155
  - darthjee@gmail.com
@@ -134,10 +162,13 @@ files:
134
162
  - ".rspec"
135
163
  - ".rubocop.yml"
136
164
  - ".rubocop_todo.yml"
165
+ - Dockerfile
137
166
  - Gemfile
138
167
  - LICENSE
139
168
  - README.md
140
169
  - Rakefile
170
+ - config/yardstick.rb
171
+ - config/yardstick.yml
141
172
  - docker-compose.yml
142
173
  - lib/sinclair.rb
143
174
  - lib/sinclair/matchers.rb
@@ -146,12 +177,14 @@ files:
146
177
  - lib/sinclair/method_definition.rb
147
178
  - lib/sinclair/options_parser.rb
148
179
  - lib/sinclair/version.rb
180
+ - scripts/check_readme.sh
149
181
  - sinclair.gemspec
150
182
  - sinclair.jpg
151
183
  - spec/integration/matcher_spec.rb
152
184
  - spec/integration/readme/matcher_spec.rb
153
185
  - spec/integration/readme/my_class_spec.rb
154
186
  - spec/integration/readme_spec.rb
187
+ - spec/integration/yard/matchers/add_method_spec.rb
155
188
  - spec/integration/yard/matchers/add_method_to_spec.rb
156
189
  - spec/integration/yard/options_parser_spec.rb
157
190
  - spec/integration/yard/sinclair_spec.rb
@@ -192,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
225
  version: '0'
193
226
  requirements: []
194
227
  rubyforge_project:
195
- rubygems_version: 2.6.11
228
+ rubygems_version: 2.7.6
196
229
  signing_key:
197
230
  specification_version: 4
198
231
  summary: Gem for easy concern creation