to_factory 2.0.0 → 3.0.0.pre.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +35 -0
- data/.gitignore +1 -0
- data/.rubocop-disabled.yml +95 -0
- data/.rubocop-enabled.yml +1194 -0
- data/.rubocop.yml +938 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +6 -1
- data/README.md +11 -10
- data/Rakefile +17 -9
- data/lib/to_factory/collation.rb +9 -9
- data/lib/to_factory/file_sync.rb +11 -11
- data/lib/to_factory/file_writer.rb +18 -2
- data/lib/to_factory/finders/factory.rb +8 -2
- data/lib/to_factory/finders/model.rb +11 -13
- data/lib/to_factory/generation/attribute.rb +10 -12
- data/lib/to_factory/generation/factory.rb +3 -3
- data/lib/to_factory/klass_inference.rb +4 -6
- data/lib/to_factory/options_parser.rb +4 -4
- data/lib/to_factory/parsing/file.rb +87 -14
- data/lib/to_factory/representation.rb +9 -6
- data/lib/to_factory/version.rb +1 -1
- data/lib/to_factory.rb +7 -17
- data/spec/db/migrate/1_create_users.rb +4 -4
- data/spec/db/migrate/2_create_projects.rb +4 -4
- data/spec/db/migrate/3_create_not_namespaced.rb +4 -4
- data/spec/db/migrate/4_add_birthday_to_users.rb +3 -3
- data/spec/db/migrate/5_add_serialized_attributes_to_users.rb +3 -3
- data/spec/example_factories/admin.rb +6 -6
- data/spec/example_factories/admin_with_header.rb +7 -7
- data/spec/example_factories/inherited_project_with_header.rb +7 -0
- data/spec/example_factories/project_with_header.rb +4 -4
- data/spec/example_factories/user.rb +5 -5
- data/spec/example_factories/user_admin.rb +11 -11
- data/spec/example_factories/user_admin_root.rb +12 -12
- data/spec/example_factories/user_admin_super_admin.rb +6 -6
- data/spec/example_factories/user_admin_with_header.rb +12 -12
- data/spec/example_factories/user_with_header.rb +6 -6
- data/spec/integration/empty_factory_file_spec.rb +19 -0
- data/spec/integration/file_sync_spec.rb +16 -24
- data/spec/integration/file_writer_spec.rb +13 -9
- data/spec/integration/lint_spec.rb +4 -3
- data/spec/integration/multiple_to_factory_calls_spec.rb +96 -0
- data/spec/integration/non_active_record_classes_spec.rb +40 -0
- data/spec/integration/to_factory_method_spec.rb +21 -20
- data/spec/spec_helper.rb +9 -18
- data/spec/support/broken_models/invalid_ruby_file.rb +1 -0
- data/spec/support/broken_models/project.rb +3 -0
- data/spec/support/data_creation.rb +11 -13
- data/spec/support/match_sexp.rb +0 -1
- data/spec/support/non_active_record/inherited_project.rb +3 -0
- data/spec/support/non_active_record/project.rb +3 -0
- data/spec/support/non_active_record/some_other_service_inheriting_from_something_else.rb +4 -0
- data/spec/support/non_active_record/some_service.rb +2 -0
- data/spec/support/non_active_record/something_else.rb +2 -0
- data/spec/support/ruby_parser_exception_causing_string.rb +29 -29
- data/spec/unit/collation_spec.rb +9 -10
- data/spec/unit/file_writer_spec.rb +4 -8
- data/spec/unit/finders/factory_spec.rb +7 -9
- data/spec/unit/finders/model_spec.rb +35 -8
- data/spec/unit/generation/attribute_spec.rb +22 -22
- data/spec/unit/generation/factory_spec.rb +38 -14
- data/spec/unit/parsing/file_spec.rb +9 -9
- data/spec/unit/parsing/klass_inference_spec.rb +5 -7
- data/to_factory.gemspec +17 -15
- metadata +109 -44
- data/.travis.yml +0 -14
- data/lib/to_factory/parsing/syntax.rb +0 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 01f94df88ff753c773d52d22da1ac7d85f16cace50153d5a77eb481fa731531e
|
4
|
+
data.tar.gz: 307ce4ac3bbafd0da3afe288b4f1529666d17db175ffc15bd3e73a2cd1dce871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64e0f3c9317cd0fc8b33e46fe8726bfb5cb2a17d03fbfc1cdbf499f817e57bb4ed8fd40331af7efbd88be4fef0b36bd6fa3fdeca297923f2bb3a288da3028444
|
7
|
+
data.tar.gz: 4fdf799e703a7bb5b29798b8406c602cdbf4d781d42a16bab3778f5699d5a6c56b8cc4939c1749c3f718996c3fadf512c42548b145e9b956aa9afcccebd8f546
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: RSpec
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
rspec:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v1
|
10
|
+
- uses: ruby/setup-ruby@v1
|
11
|
+
with:
|
12
|
+
bundler-cache: false
|
13
|
+
ruby-version: 2.7.5
|
14
|
+
- uses: actions/cache@v2
|
15
|
+
with:
|
16
|
+
path: .github/vendor/bundle
|
17
|
+
key: bundle-use-ruby-for-danger-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
18
|
+
restore-keys: |
|
19
|
+
bundle-use-ruby-for-danger-${{ matrix.os }}-${{ matrix.ruby }}-
|
20
|
+
- name: bundle install
|
21
|
+
run: |
|
22
|
+
cd .github
|
23
|
+
bundle install --path=vendor/bundle --jobs 4 --retry 3
|
24
|
+
- name: setup db
|
25
|
+
run: |
|
26
|
+
bundle exec rake spec:migrate_db
|
27
|
+
- name: RSpec tests
|
28
|
+
run: bundle exec rspec -f j -o tmp/rspec_results.json -f p
|
29
|
+
|
30
|
+
- name: RSpec Report
|
31
|
+
uses: SonicGarden/rspec-report-action@v2
|
32
|
+
with:
|
33
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
34
|
+
json-path: tmp/rspec_results.json
|
35
|
+
if: always()
|
data/.gitignore
CHANGED
@@ -0,0 +1,95 @@
|
|
1
|
+
# These are all the cops that are disabled in the default configuration.
|
2
|
+
|
3
|
+
Style/AutoResourceCleanup:
|
4
|
+
Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Style/CollectionMethods:
|
8
|
+
Description: 'Preferred collection methods.'
|
9
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size'
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Style/Copyright:
|
13
|
+
Description: 'Include a copyright notice in each file before any code.'
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/Encoding:
|
17
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
18
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#utf-8'
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/InlineComment:
|
22
|
+
Description: 'Avoid inline comments.'
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/FirstArrayElementLineBreak:
|
26
|
+
Description: >-
|
27
|
+
Checks for a line break before the first element in a
|
28
|
+
multi-line array.
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/FirstHashElementLineBreak:
|
32
|
+
Description: >-
|
33
|
+
Checks for a line break before the first element in a
|
34
|
+
multi-line hash.
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/FirstMethodArgumentLineBreak:
|
38
|
+
Description: >-
|
39
|
+
Checks for a line break before the first argument in a
|
40
|
+
multi-line method call.
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/FirstMethodParameterLineBreak:
|
44
|
+
Description: >-
|
45
|
+
Checks for a line break before the first parameter in a
|
46
|
+
multi-line method parameter definition.
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Style/MethodCalledOnDoEndBlock:
|
50
|
+
Description: 'Avoid chaining a method call on a do...end block.'
|
51
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/MissingElse:
|
55
|
+
Description: >-
|
56
|
+
Require if/case expressions to have an else branches.
|
57
|
+
If enabled, it is recommended that
|
58
|
+
Style/UnlessElse and Style/EmptyElse be enabled.
|
59
|
+
This will conflict with Style/EmptyElse if
|
60
|
+
Style/EmptyElse is configured to style "both"
|
61
|
+
Enabled: false
|
62
|
+
EnforcedStyle: both
|
63
|
+
SupportedStyles:
|
64
|
+
# if - warn when an if expression is missing an else branch
|
65
|
+
# case - warn when a case expression is missing an else branch
|
66
|
+
# both - warn when an if or case expression is missing an else branch
|
67
|
+
- if
|
68
|
+
- case
|
69
|
+
- both
|
70
|
+
|
71
|
+
Style/MutableConstant:
|
72
|
+
Description: 'Do not assign mutable objects to constants.'
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Style/OptionHash:
|
76
|
+
Description: "Don't use option hashes when you can use keyword arguments."
|
77
|
+
Enabled: false
|
78
|
+
|
79
|
+
Style/Send:
|
80
|
+
Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
|
81
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#prefer-public-send'
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
Style/StringMethods:
|
85
|
+
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Style/SymbolArray:
|
89
|
+
Description: 'Use %i or %I for arrays of symbols.'
|
90
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-i'
|
91
|
+
Enabled: false
|
92
|
+
|
93
|
+
Lint/LiteralInInterpolation:
|
94
|
+
Description: 'Avoid interpolating literals in strings'
|
95
|
+
AutoCorrect: false
|