microscope 0.6.2 → 1.0.0

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
  SHA1:
3
- metadata.gz: 33dac82bbfb0ee0add9e83ad93ebea6525f4f427
4
- data.tar.gz: bbdc35dd0547369edac2fbb0877b42c970042584
3
+ metadata.gz: dae239d9a336e0f5dae1eb39800dbf21eecef2d5
4
+ data.tar.gz: 2afd2fc1a3eaa7dddb9282a1f1a8daee169a8ec9
5
5
  SHA512:
6
- metadata.gz: 3ec8faf2b9878a7fef29fce73a13720b54a6befff22580959252506240851549f05e79bd009c4487cf29b200f43825c9f1f44ae9c77f93a1db29423fc4aa8f1b
7
- data.tar.gz: 5e36fb8f4f6819d721cb442cec88ec4ceffb7e430df68631f0cb59e8bc6069d9fb1d5975bdae1bd812f684b294fa1b3416e2f65fa7433c65bd9add25829dec2f
6
+ metadata.gz: 9348ae5d7f3f2bfd6be7b7f4beebe8f1b82fd052ba0ca56df81c7f66dc81825e6281a8153c0628a501be3d91c29cb0003396c5ecf6b0f6c6b5393e1cbe053316
7
+ data.tar.gz: cbcf09bb50632e1794b7c6095e03e3ef7bb1e7adc97d7538f906cf4e027a59dd9ce1a3e35e1c70e598d285fb813b22b6e1f6a8dcb9556dd6f5fef6d512fb805e
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- Include:
2
+ Exclude:
3
3
  - microscope.gemspec
4
4
 
5
5
  Documentation:
@@ -11,9 +11,6 @@ Encoding:
11
11
  LineLength:
12
12
  Max: 200
13
13
 
14
- ClassLength:
15
- Max: 200
16
-
17
14
  AccessModifierIndentation:
18
15
  EnforcedStyle: outdent
19
16
 
@@ -37,14 +34,29 @@ ColonMethodCall:
37
34
  AsciiComments:
38
35
  Enabled: false
39
36
 
40
- Lambda:
41
- Enabled: false
42
-
43
37
  RegexpLiteral:
44
38
  Enabled: false
45
39
 
46
40
  AssignmentInCondition:
47
41
  Enabled: false
48
42
 
49
- ClassAndModuleChildren:
43
+ ParameterLists:
44
+ CountKeywordArgs: false
45
+
46
+ SingleLineBlockParams:
47
+ Methods:
48
+ - reduce:
49
+ - memo
50
+ - item
51
+
52
+ Metrics/AbcSize:
50
53
  Enabled: false
54
+
55
+ Style/CollectionMethods:
56
+ Enabled: true
57
+
58
+ Style/SymbolArray:
59
+ Enabled: true
60
+
61
+ Style/ExtraSpacing:
62
+ Enabled: true
data/.travis.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
+ sudo: false
2
3
 
3
4
  rvm:
4
- - 2.0.0
5
+ - 2.0
6
+ - 2.1
7
+ - 2.2
5
8
 
6
9
  gemfile:
7
10
  - gemfiles/Gemfile.activerecord-4.1
data/README.md CHANGED
@@ -7,7 +7,6 @@
7
7
  <br /><br />
8
8
  <a href="https://rubygems.org/gems/microscope"><img src="http://img.shields.io/gem/v/microscope.svg" /></a>
9
9
  <a href="https://codeclimate.com/github/mirego/microscope"><img src="http://img.shields.io/codeclimate/github/mirego/microscope.svg" /></a>
10
- <a href='https://coveralls.io/r/mirego/microscope?branch=master'><img src="http://img.shields.io/coveralls/mirego/microscope.svg" /></a>
11
10
  <a href='https://gemnasium.com/mirego/microscope'><img src="http://img.shields.io/gemnasium/mirego/microscope.svg" /></a>
12
11
  <a href="https://travis-ci.org/mirego/microscope"><img src="http://img.shields.io/travis/mirego/microscope.svg" /></a>
13
12
  </p>
@@ -73,7 +72,7 @@ Event.not_archived
73
72
  # SELECT * FROM `events` where `events`.`archived_on` IS NULL OR `events`.`archived_on` > '2013-07-05 15:43:42'
74
73
  ```
75
74
 
76
- Microscope also adds three instance methods to the model per scope.
75
+ Microscope also adds a few instance methods to the model per scope.
77
76
 
78
77
  ```ruby
79
78
  event = Event.archived.first
@@ -92,7 +91,7 @@ event.reload
92
91
  event.archived? # => false
93
92
  event.archived_at # => nil
94
93
 
95
- event.archive! # (same as #mark_as_archived but save the record immediately)
94
+ event.mark_as_archived! # (same as #mark_as_archived but save the record immediately)
96
95
  event.archived? # => true
97
96
  event.archived_at # => 2013-07-05 15:43:42
98
97
  event.reload
@@ -102,24 +101,6 @@ event.archived_at # => 2013-07-05 15:43:42
102
101
 
103
102
  ### Options
104
103
 
105
- #### Special verbs
106
-
107
- Microscope uses a rather simple process to convert field names to infinitive
108
- verbs. It just removes the `d` if there’s one at the end of the verb. It also
109
- has its own irregular verbs list.
110
-
111
- For example, a `liked_at` field name will give `like!` and `unlike!` instance
112
- methods to records.
113
-
114
- But you can configure Microscope to use your own special verbs. For example:
115
-
116
- ```ruby
117
- # config/initializers/microscope.rb
118
- Microscope.configure do |config|
119
- config.special_verbs = { 'extracted' => 'extract', 'started' => 'start' }
120
- end
121
- ```
122
-
123
104
  #### On `acts_as_microscope`
124
105
 
125
106
  You can also use a few options when calling `acts_as_microscope`:
data/lib/microscope.rb CHANGED
@@ -17,39 +17,22 @@ require 'microscope/instance_method/datetime_instance_method'
17
17
  require 'microscope/instance_method/date_instance_method'
18
18
 
19
19
  module Microscope
20
- IRREGULAR_VERBS_FILE = File.expand_path('../../data/irregular_verbs.yml', __FILE__)
21
-
22
- def self.special_verbs
23
- irregular_verbs_from_yaml ||= YAML.load_file(IRREGULAR_VERBS_FILE)
24
- special_verbs_from_configuration ||= configuration.special_verbs
25
-
26
- @special_verbs ||= begin
27
- irregular_verbs_from_yaml.merge(special_verbs_from_configuration)
28
- end
29
- end
30
-
31
- def self.configure
32
- @configuration = configuration
33
- yield(@configuration)
34
- end
35
-
36
- def self.configuration
37
- @configuration ||= OpenStruct.new(special_verbs: {})
38
- end
39
20
  end
40
21
 
41
- class ActiveRecord::Base
42
- def self.acts_as_microscope(options = {})
43
- return unless table_exists?
22
+ module ActiveRecord
23
+ class Base
24
+ def self.acts_as_microscope(options = {})
25
+ return unless table_exists?
44
26
 
45
- except = options[:except] || []
46
- model_columns = columns.dup.reject { |c| except.include?(c.name.to_sym) }
27
+ except = options[:except] || []
28
+ model_columns = columns.dup.reject { |c| except.include?(c.name.to_sym) }
47
29
 
48
- if only = options[:only]
49
- model_columns = model_columns.select { |c| only.include?(c.name.to_sym) }
50
- end
30
+ if only = options[:only]
31
+ model_columns = model_columns.select { |c| only.include?(c.name.to_sym) }
32
+ end
51
33
 
52
- Microscope::Scope.inject_scopes(self, model_columns, options)
53
- Microscope::InstanceMethod.inject_instance_methods(self, model_columns, options)
34
+ Microscope::Scope.inject_scopes(self, model_columns, options)
35
+ Microscope::InstanceMethod.inject_instance_methods(self, model_columns, options)
36
+ end
54
37
  end
55
38
  end
@@ -10,7 +10,7 @@ module Microscope
10
10
  end
11
11
 
12
12
  # Inject ActiveRecord scopes into a model
13
- def self.inject_instance_methods(model, fields, options = {})
13
+ def self.inject_instance_methods(model, fields, _options)
14
14
  fields.each do |field|
15
15
  scope = "#{field.type.to_s.camelize}InstanceMethod"
16
16
  "Microscope::InstanceMethod::#{scope}".constantize.new(model, field).apply if const_defined?(scope)
@@ -2,25 +2,23 @@ module Microscope
2
2
  class InstanceMethod
3
3
  class BooleanInstanceMethod < InstanceMethod
4
4
  def apply
5
- infinitive_verb = Microscope::Utils.past_participle_to_infinitive(field.name)
6
-
7
5
  model.class_eval <<-RUBY, __FILE__, __LINE__ + 1
8
- define_method "#{infinitive_verb}!" do
9
- send("#{field.name}=", true)
6
+ define_method 'mark_as_#{field.name}!' do
7
+ mark_as_#{field.name}
10
8
  save!
11
9
  end
12
10
 
13
- define_method "not_#{infinitive_verb}!" do
14
- send("#{field.name}=", false)
11
+ define_method 'mark_as_not_#{field.name}!' do
12
+ mark_as_not_#{field.name}
15
13
  save!
16
14
  end
17
- alias_method 'un#{infinitive_verb}!', 'not_#{infinitive_verb}!'
15
+ alias_method 'mark_as_un#{field.name}!', 'mark_as_not_#{field.name}!'
18
16
 
19
- define_method "mark_as_#{field.name}" do
17
+ define_method 'mark_as_#{field.name}' do
20
18
  send("#{field.name}=", true)
21
19
  end
22
20
 
23
- define_method "mark_as_not_#{field.name}" do
21
+ define_method 'mark_as_not_#{field.name}' do
24
22
  send("#{field.name}=", false)
25
23
  end
26
24
  alias_method 'mark_as_un#{field.name}', 'mark_as_not_#{field.name}'
@@ -10,7 +10,6 @@ module Microscope
10
10
 
11
11
  def apply
12
12
  @cropped_field = field.name.gsub(@cropped_field_regex, '')
13
- @infinitive_verb = Microscope::Utils.past_participle_to_infinitive(cropped_field)
14
13
 
15
14
  model.class_eval(apply_methods) if @field_name =~ @cropped_field_regex
16
15
  end
@@ -38,13 +37,13 @@ module Microscope
38
37
 
39
38
  def apply_bang_methods
40
39
  <<-RUBY
41
- define_method '#{@infinitive_verb}!' do
42
- send('#{field.name}=', #{@now})
40
+ define_method 'mark_as_#{@cropped_field}!' do
41
+ mark_as_#{@cropped_field}
43
42
  save!
44
43
  end
45
44
 
46
- define_method 'not_#{@infinitive_verb}!' do
47
- send('#{field.name}=', nil)
45
+ define_method 'mark_as_not_#{@cropped_field}!' do
46
+ mark_as_not_#{@cropped_field}
48
47
  save!
49
48
  end
50
49
  RUBY
@@ -63,7 +62,7 @@ module Microscope
63
62
 
64
63
  def apply_aliases
65
64
  <<-RUBY
66
- alias_method 'un#{@infinitive_verb}!', 'not_#{@infinitive_verb}!'
65
+ alias_method 'mark_as_un#{@cropped_field}!', 'mark_as_not_#{@cropped_field}!'
67
66
  alias_method 'mark_as_un#{@cropped_field}', 'mark_as_not_#{@cropped_field}'
68
67
  alias_method 'un#{@cropped_field}?', 'not_#{@cropped_field}?'
69
68
  RUBY
@@ -16,7 +16,7 @@ module Microscope
16
16
  end
17
17
 
18
18
  # Inject ActiveRecord scopes into a model
19
- def self.inject_scopes(model, fields, options = {})
19
+ def self.inject_scopes(model, fields, _options)
20
20
  fields.each do |field|
21
21
  scope = "#{field.type.to_s.camelize}Scope"
22
22
  "Microscope::Scope::#{scope}".constantize.new(model, field).apply if const_defined?(scope)
@@ -1,20 +1,5 @@
1
1
  module Microscope
2
2
  module Utils
3
- # Convert a past participle to its infinitive form
4
- def self.past_participle_to_infinitive(key)
5
- *key, participle = key.split('_')
6
-
7
- infinitive = participle
8
-
9
- if Microscope.special_verbs.include?(participle)
10
- infinitive = Microscope.special_verbs[participle]
11
- elsif participle =~ /ed$/
12
- infinitive = participle.sub(/d$/, '')
13
- end
14
-
15
- (key << infinitive).join('_')
16
- end
17
-
18
3
  # Convert a value to its boolean representation
19
4
  def self.value_to_boolean(value)
20
5
  ![nil, false, 0, '0', 'f', 'F', 'false', 'FALSE'].include?(value.presence)
@@ -1,3 +1,3 @@
1
1
  module Microscope
2
- VERSION = '0.6.2'
2
+ VERSION = '1.0.0'
3
3
  end
data/microscope.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'microscope/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'microscope'
8
8
  spec.version = Microscope::VERSION
9
- spec.authors = ['Simon Prévost', 'Rémi Prévost']
10
- spec.email = ['sprevost@mirego.com', 'rprevost@mirego.com']
9
+ spec.authors = ['Simon Prévost', 'Rémi Prévost', 'Samuel Garneau']
10
+ spec.email = ['sprevost@mirego.com', 'rprevost@mirego.com', 'sgarneau@mirego.com']
11
11
  spec.description = 'Microscope adds useful scopes targeting ActiveRecord boolean and datetime fields.'
12
12
  spec.summary = spec.description
13
13
  spec.homepage = 'https://github.com/mirego/microscope'
@@ -23,11 +23,10 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.3'
25
25
  spec.add_development_dependency 'rake'
26
- spec.add_development_dependency 'rspec', '3.0.0.rc1'
26
+ spec.add_development_dependency 'rspec', '~> 3.1'
27
27
  spec.add_development_dependency 'sqlite3'
28
28
  spec.add_development_dependency 'pg'
29
29
  spec.add_development_dependency 'mysql2', '~> 0.3.13'
30
- spec.add_development_dependency 'coveralls'
31
- spec.add_development_dependency 'rubocop', '0.20.1'
30
+ spec.add_development_dependency 'rubocop', '~> 0.28'
32
31
  spec.add_development_dependency 'phare'
33
32
  end
@@ -11,15 +11,17 @@ describe Microscope::InstanceMethod::BooleanInstanceMethod do
11
11
  microscope 'Animal'
12
12
  end
13
13
 
14
- describe '#feed!' do
14
+ describe '#mark_as_fed!' do
15
15
  let(:animal) { Animal.create(fed: false) }
16
- it { expect { animal.feed! }.to change { animal.reload.fed? }.from(false).to(true) }
16
+ it { expect { animal.mark_as_fed! }.to change { animal.reload.fed? }.from(false).to(true) }
17
+ it { expect(animal).to respond_to(:mark_as_fed!) }
17
18
  end
18
19
 
19
- describe '#not_feed!' do
20
+ describe '#mark_as_not_fed!' do
20
21
  let(:animal) { Animal.create(fed: true) }
21
- it { expect { animal.not_feed! }.to change { animal.reload.fed? }.from(true).to(false) }
22
- it { expect(animal).to respond_to(:unfeed!) }
22
+ it { expect { animal.mark_as_not_fed! }.to change { animal.reload.fed? }.from(true).to(false) }
23
+ it { expect(animal).to respond_to(:mark_as_unfed!) }
24
+ it { expect(animal).to respond_to(:mark_as_not_fed!) }
23
25
  end
24
26
 
25
27
  describe '#mark_as_fed' do
@@ -2,10 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Microscope::InstanceMethod::DateInstanceMethod do
4
4
  before do
5
- Microscope.configure do |config|
6
- config.special_verbs = { 'started' => 'start' }
7
- end
8
-
9
5
  run_migration do
10
6
  create_table(:events, force: true) do |t|
11
7
  t.date :start_date, default: nil
@@ -77,20 +73,19 @@ describe Microscope::InstanceMethod::DateInstanceMethod do
77
73
  end
78
74
  end
79
75
 
80
- describe '#start!' do
76
+ describe '#mark_as_started!' do
81
77
  let(:stubbed_date) { Date.parse('2020-03-18 08:00:00') }
82
78
  before { allow(Date).to receive(:today).and_return(stubbed_date) }
83
79
 
84
80
  let(:event) { Event.create(started_on: nil) }
85
- it { expect { event.start! }.to change { event.reload.started_on }.from(nil).to(stubbed_date) }
81
+ it { expect { event.mark_as_started! }.to change { event.reload.started_on }.from(nil).to(stubbed_date) }
86
82
  end
87
83
 
88
- describe '#not_start!' do
84
+ describe '#mark_as_not_started!' do
89
85
  let(:stubbed_date) { Date.parse('2020-03-18 08:00:00') }
90
86
 
91
87
  let(:event) { Event.create(started_on: stubbed_date) }
92
- it { expect { event.not_start! }.to change { event.reload.started_on }.from(stubbed_date).to(nil) }
93
- it { expect(event).to respond_to(:unstart!) }
88
+ it { expect { event.mark_as_not_started! }.to change { event.reload.started_on }.from(stubbed_date).to(nil) }
94
89
  end
95
90
 
96
91
  describe '#mark_as_started' do
@@ -2,10 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Microscope::InstanceMethod::DatetimeInstanceMethod do
4
4
  before do
5
- Microscope.configure do |config|
6
- config.special_verbs = { 'started' => 'start' }
7
- end
8
-
9
5
  run_migration do
10
6
  create_table(:events, force: true) do |t|
11
7
  t.datetime :started_at, default: nil
@@ -66,20 +62,22 @@ describe Microscope::InstanceMethod::DatetimeInstanceMethod do
66
62
  end
67
63
  end
68
64
 
69
- describe '#start!' do
65
+ describe '#mark_as_started!' do
70
66
  let(:stubbed_date) { Time.parse('2020-03-18 08:00:00') }
71
67
  before { allow(Time).to receive(:now).and_return(stubbed_date) }
72
68
 
73
69
  let(:event) { Event.create(started_at: nil) }
74
- it { expect { event.start! }.to change { event.reload.started_at }.from(nil).to(stubbed_date) }
70
+ it { expect { event.mark_as_started! }.to change { event.reload.started_at }.from(nil).to(stubbed_date) }
71
+ it { expect(event).to respond_to(:mark_as_started!) }
75
72
  end
76
73
 
77
- describe '#not_start!' do
74
+ describe '#mark_as_not_started!' do
78
75
  let(:stubbed_date) { Time.parse('2020-03-18 08:00:00') }
79
76
 
80
77
  let(:event) { Event.create(started_at: stubbed_date) }
81
- it { expect { event.not_start! }.to change { event.reload.started_at }.from(stubbed_date).to(nil) }
82
- it { expect(event).to respond_to(:unstart!) }
78
+ it { expect { event.mark_as_not_started! }.to change { event.reload.started_at }.from(stubbed_date).to(nil) }
79
+ it { expect(event).to respond_to(:mark_as_unstarted!) }
80
+ it { expect(event).to respond_to(:mark_as_not_started!) }
83
81
  end
84
82
 
85
83
  describe '#mark_as_started' do
@@ -23,7 +23,7 @@ describe Microscope do
23
23
 
24
24
  describe :except do
25
25
  before do
26
- microscope 'User', except: [:admin, :removed_at, :ended_on]
26
+ microscope 'User', except: %i(admin removed_at ended_on)
27
27
  end
28
28
 
29
29
  it { expect(User).to respond_to :active }
@@ -57,7 +57,7 @@ describe Microscope do
57
57
 
58
58
  describe :only do
59
59
  before do
60
- microscope 'User', only: [:admin, :removed_at, :ended_on]
60
+ microscope 'User', only: %i(admin removed_at ended_on)
61
61
  end
62
62
 
63
63
  it { expect(User).to_not respond_to :active }
@@ -91,7 +91,7 @@ describe Microscope do
91
91
 
92
92
  describe 'except and only' do
93
93
  before do
94
- microscope 'User', only: [:admin, :started_on], except: [:active]
94
+ microscope 'User', only: %i(admin started_on), except: %i(active)
95
95
  end
96
96
 
97
97
  it { expect(User).to_not respond_to :active }
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
2
 
3
- require 'coveralls'
4
- Coveralls.wear!
5
-
6
3
  require 'rspec'
7
4
  require 'sqlite3'
8
5
  require 'mysql2'
@@ -27,9 +24,5 @@ RSpec.configure do |config|
27
24
  # Establish ActiveRecord database connection
28
25
  adapter = ENV['DB_ADAPTER'] || 'sqlite3'
29
26
  setup_database(adapter: adapter, database: 'microscope_test')
30
-
31
- # Reset internal variables
32
- Microscope.instance_variable_set(:@configuration, nil)
33
- Microscope.instance_variable_set(:@special_verbs, nil)
34
27
  end
35
28
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Prévost
8
8
  - Rémi Prévost
9
+ - Samuel Garneau
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-08-12 00:00:00.000000000 Z
13
+ date: 2015-01-12 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: activesupport
@@ -71,16 +72,16 @@ dependencies:
71
72
  name: rspec
72
73
  requirement: !ruby/object:Gem::Requirement
73
74
  requirements:
74
- - - '='
75
+ - - "~>"
75
76
  - !ruby/object:Gem::Version
76
- version: 3.0.0.rc1
77
+ version: '3.1'
77
78
  type: :development
78
79
  prerelease: false
79
80
  version_requirements: !ruby/object:Gem::Requirement
80
81
  requirements:
81
- - - '='
82
+ - - "~>"
82
83
  - !ruby/object:Gem::Version
83
- version: 3.0.0.rc1
84
+ version: '3.1'
84
85
  - !ruby/object:Gem::Dependency
85
86
  name: sqlite3
86
87
  requirement: !ruby/object:Gem::Requirement
@@ -123,34 +124,20 @@ dependencies:
123
124
  - - "~>"
124
125
  - !ruby/object:Gem::Version
125
126
  version: 0.3.13
126
- - !ruby/object:Gem::Dependency
127
- name: coveralls
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '0'
133
- type: :development
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '0'
140
127
  - !ruby/object:Gem::Dependency
141
128
  name: rubocop
142
129
  requirement: !ruby/object:Gem::Requirement
143
130
  requirements:
144
- - - '='
131
+ - - "~>"
145
132
  - !ruby/object:Gem::Version
146
- version: 0.20.1
133
+ version: '0.28'
147
134
  type: :development
148
135
  prerelease: false
149
136
  version_requirements: !ruby/object:Gem::Requirement
150
137
  requirements:
151
- - - '='
138
+ - - "~>"
152
139
  - !ruby/object:Gem::Version
153
- version: 0.20.1
140
+ version: '0.28'
154
141
  - !ruby/object:Gem::Dependency
155
142
  name: phare
156
143
  requirement: !ruby/object:Gem::Requirement
@@ -170,6 +157,7 @@ description: Microscope adds useful scopes targeting ActiveRecord boolean and da
170
157
  email:
171
158
  - sprevost@mirego.com
172
159
  - rprevost@mirego.com
160
+ - sgarneau@mirego.com
173
161
  executables: []
174
162
  extensions: []
175
163
  extra_rdoc_files: []
@@ -182,7 +170,6 @@ files:
182
170
  - LICENSE.md
183
171
  - README.md
184
172
  - Rakefile
185
- - data/irregular_verbs.yml
186
173
  - gemfiles/Gemfile.activerecord-4.1
187
174
  - lib/microscope.rb
188
175
  - lib/microscope/instance_method.rb
@@ -202,7 +189,6 @@ files:
202
189
  - spec/microscope/scope/boolean_scope_spec.rb
203
190
  - spec/microscope/scope/date_scope_spec.rb
204
191
  - spec/microscope/scope/datetime_scope_spec.rb
205
- - spec/microscope/utils_spec.rb
206
192
  - spec/microscope_spec.rb
207
193
  - spec/spec_helper.rb
208
194
  - spec/support/macros/database/database_adapter.rb
@@ -243,7 +229,6 @@ test_files:
243
229
  - spec/microscope/scope/boolean_scope_spec.rb
244
230
  - spec/microscope/scope/date_scope_spec.rb
245
231
  - spec/microscope/scope/datetime_scope_spec.rb
246
- - spec/microscope/utils_spec.rb
247
232
  - spec/microscope_spec.rb
248
233
  - spec/spec_helper.rb
249
234
  - spec/support/macros/database/database_adapter.rb
@@ -1,155 +0,0 @@
1
- arisen: arise
2
- awoken: awake
3
- been: be
4
- borne: bear
5
- beaten: beat
6
- beat: beat
7
- become: become
8
- begun: begin
9
- bent: bend
10
- bet: bet
11
- bitten: bite
12
- bled: bleed
13
- blown: blow
14
- broken: break
15
- brought: bring
16
- built: build
17
- burnt: burn
18
- burst: burst
19
- bought: buy
20
- caught: catch
21
- cancelled: cancel
22
- chosen: choose
23
- clung: cling
24
- come: come
25
- cost: cost
26
- crept: creep
27
- cut: cut
28
- dealt: deal
29
- dug: dig
30
- dived: dive
31
- done: do
32
- drawn: draw
33
- dreamt: dream
34
- drunk: drink
35
- driven: drive
36
- eaten: eat
37
- fallen: fall
38
- fed: feed
39
- felt: feel
40
- fought: fight
41
- found: find
42
- fit: fit
43
- fled: flee
44
- flung: fling
45
- flown: fly
46
- forbidden: forbid
47
- forbade: forbid
48
- forgotten: forget
49
- forgiven: forgive
50
- forgone: forgo
51
- frozen: freeze
52
- gotten: get
53
- got: get
54
- given: give
55
- gone: go
56
- ground: grind
57
- grown: grow
58
- hung: hang
59
- had: have
60
- heard: hear
61
- hidden: hide
62
- hit: hit
63
- held: hold
64
- hurt: hurt
65
- kept: keep
66
- knelt: kneel
67
- knit: knit
68
- known: know
69
- laid: lay
70
- led: lead
71
- leapt: leap
72
- left: leave
73
- lent: lend
74
- let: let
75
- lain: lie
76
- lit: light
77
- lost: lose
78
- made: make
79
- meant: mean
80
- met: meet
81
- paid: pay
82
- proven: prove
83
- put: put
84
- quit: quit
85
- read: read
86
- ridden: ride
87
- rung: ring
88
- risen: rise
89
- run: run
90
- sawn: saw
91
- said: say
92
- seen: see
93
- sought: seek
94
- sold: sell
95
- sent: send
96
- set: set
97
- sewn: sew
98
- shaken: shake
99
- shaven: shave
100
- shorn: shear
101
- shone: shine
102
- shot: shoot
103
- shown: show
104
- shrunken: shrink
105
- shrunk: shrink
106
- shut: shut
107
- sung: sing
108
- sunk: sink
109
- sat: sit
110
- slain: slay
111
- slept: sleep
112
- slid: slide
113
- snuck: sneak
114
- spoken: speak
115
- sped: speed
116
- spent: spend
117
- spilt: spill
118
- spun: spin
119
- spit: spit
120
- spat: spit
121
- split: split
122
- spread: spread
123
- sprung: spring
124
- stood: stand
125
- stolen: steal
126
- stuck: stick
127
- stung: sting
128
- stunk: stink
129
- strewn: strew
130
- struck: strike
131
- stricken: strike
132
- striven: strive
133
- sworn: swear
134
- swept: sweep
135
- swum: swim
136
- swung: swing
137
- taken: take
138
- taught: teach
139
- torn: tear
140
- told: tell
141
- thought: think
142
- thriven: thrive
143
- thrown: throw
144
- undergone: undergo
145
- understood: understand
146
- upset: upset
147
- woken: wake
148
- worn: wear
149
- woven: weave
150
- wept: weep
151
- won: win
152
- wound: wind
153
- withdrawn: withdraw
154
- wrung: wring
155
- written: write
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Microscope::Utils do
4
- describe :ClassMethods do
5
- describe :past_participle_to_infinitive do
6
- before do
7
- Microscope.configure do |config|
8
- config.special_verbs = { 'started' => 'start', 'foo' => 'bar', 'canceled' => 'cancel' }
9
- end
10
- end
11
-
12
- let(:past_participles) { %w(liked loved gateway_canceled started fed foo) }
13
- let(:infinitives) { %w(like love gateway_cancel start feed bar) }
14
- let(:mapped_past_participles) { past_participles.map { |v| Microscope::Utils.past_participle_to_infinitive(v) } }
15
-
16
- specify do
17
- expect(mapped_past_participles).to eql infinitives
18
- end
19
- end
20
- end
21
- end