smtp_mock 0.1.0

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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +132 -0
  3. data/.codeclimate.yml +13 -0
  4. data/.github/BRANCH_NAMING_CONVENTION.md +36 -0
  5. data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  7. data/.github/ISSUE_TEMPLATE/issue_report.md +28 -0
  8. data/.github/ISSUE_TEMPLATE/question.md +22 -0
  9. data/.github/PULL_REQUEST_TEMPLATE.md +49 -0
  10. data/.gitignore +12 -0
  11. data/.overcommit.yml +32 -0
  12. data/.reek.yml +30 -0
  13. data/.rspec +3 -0
  14. data/.rubocop.yml +396 -0
  15. data/.ruby-gemset +1 -0
  16. data/.ruby-version +1 -0
  17. data/CHANGELOG.md +9 -0
  18. data/CODE_OF_CONDUCT.md +74 -0
  19. data/CONTRIBUTING.md +46 -0
  20. data/Gemfile +5 -0
  21. data/LICENSE.txt +21 -0
  22. data/README.md +242 -0
  23. data/Rakefile +8 -0
  24. data/bin/console +15 -0
  25. data/bin/setup +8 -0
  26. data/bin/smtp_mock +6 -0
  27. data/lib/smtp_mock/cli/resolver.rb +61 -0
  28. data/lib/smtp_mock/cli.rb +17 -0
  29. data/lib/smtp_mock/command_line_args_builder.rb +94 -0
  30. data/lib/smtp_mock/core.rb +18 -0
  31. data/lib/smtp_mock/dependency.rb +26 -0
  32. data/lib/smtp_mock/error/argument.rb +7 -0
  33. data/lib/smtp_mock/error/dependency.rb +9 -0
  34. data/lib/smtp_mock/error/server.rb +7 -0
  35. data/lib/smtp_mock/server/port.rb +27 -0
  36. data/lib/smtp_mock/server/process.rb +44 -0
  37. data/lib/smtp_mock/server.rb +59 -0
  38. data/lib/smtp_mock/test_framework/rspec/helper.rb +15 -0
  39. data/lib/smtp_mock/test_framework/rspec/interface.rb +29 -0
  40. data/lib/smtp_mock/test_framework/rspec.rb +10 -0
  41. data/lib/smtp_mock/version.rb +5 -0
  42. data/lib/smtp_mock.rb +19 -0
  43. data/smtp_mock.gemspec +49 -0
  44. data/tmp/.gitkeep +0 -0
  45. metadata +288 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fb49ea91d72556e9fb31cebc207f451ccdf7da2caa5e44f24948825dcfd67cb2
4
+ data.tar.gz: 2fe977a3136ed5348253a19c4a738ef12f39d1f53950e9dd9e82bfdd5d724bd6
5
+ SHA512:
6
+ metadata.gz: 793bb2a7cbd7e836096ebe6101547bb2dc2828fc01f32c097cf89a7d4e9ae6c4e68b2717011b037f0eada049274bf60eb050c1827c1449e4d9f5fe2226ff6161
7
+ data.tar.gz: 9ab96c8087f36adacc93157f521682783dafd5615f6fc05b4c0d85aa85c2490e4c31c0ee9c80005362219288c98547fbc1b76f2724f7c3bfee37cedee60c7173
@@ -0,0 +1,132 @@
1
+ version: 2.1
2
+
3
+ defaults: &defaults
4
+ working_directory: ~/ruby-smtp-mock
5
+ docker:
6
+ - image: cimg/ruby:<< parameters.ruby-version >>
7
+
8
+ orbs:
9
+ ruby: circleci/ruby@1.2.0
10
+
11
+ references:
12
+ restore_bundle_cache: &restore_bundle_cache
13
+ restore_cache:
14
+ keys:
15
+ - ruby-smtp-mock-{{ checksum "smtp_mock.gemspec" }}
16
+
17
+ bundle_install: &bundle_install
18
+ run:
19
+ name: Installing gems
20
+ command: |
21
+ bundle config set --local path 'vendor/bundle'
22
+ bundle install
23
+
24
+ save_bundle_cache: &save_bundle_cache
25
+ save_cache:
26
+ key: ruby-smtp-mock-{{ checksum "smtp_mock.gemspec" }}
27
+ paths:
28
+ - vendor/bundle
29
+
30
+ system_dependencies: &system_dependencies
31
+ run:
32
+ name: Installing system requirements
33
+ command: |
34
+ bundle exec smtp_mock -s -i ~
35
+
36
+ install_codeclimate_reporter: &install_codeclimate_reporter
37
+ run:
38
+ name: Installing CodeClimate test reporter
39
+ command: |
40
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
41
+ chmod +x ./cc-test-reporter
42
+
43
+ jobs:
44
+ linters-ruby:
45
+ parameters:
46
+ ruby-version:
47
+ type: string
48
+
49
+ <<: *defaults
50
+
51
+ steps:
52
+ - checkout
53
+
54
+ - <<: *restore_bundle_cache
55
+ - <<: *bundle_install
56
+ - <<: *save_bundle_cache
57
+
58
+ - run:
59
+ name: Running Overcommit
60
+ command: |
61
+ bundle exec overcommit -s
62
+ SKIP=AuthorEmail,AuthorName bundle exec overcommit -r
63
+
64
+ tests-ruby:
65
+ parameters:
66
+ ruby-version:
67
+ type: string
68
+
69
+ <<: *defaults
70
+
71
+ steps:
72
+ - checkout
73
+
74
+ - <<: *restore_bundle_cache
75
+ - <<: *bundle_install
76
+ - <<: *save_bundle_cache
77
+ - <<: *system_dependencies
78
+ - <<: *install_codeclimate_reporter
79
+
80
+ - run:
81
+ name: Running RSpec
82
+ command: |
83
+ ./cc-test-reporter before-build
84
+ bundle exec rspec
85
+
86
+ - run:
87
+ name: Creating CodeClimate test coverage report
88
+ command: |
89
+ ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
90
+
91
+ - store_artifacts:
92
+ name: Saving Simplecov coverage artifacts
93
+ path: ~/ruby-smtp-mock/coverage
94
+ destination: coverage
95
+
96
+ - deploy:
97
+ name: Uploading CodeClimate test coverage report
98
+ command: |
99
+ ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
100
+
101
+ compatibility-ruby:
102
+ parameters:
103
+ ruby-version:
104
+ type: string
105
+ docker:
106
+ - image: cimg/ruby:<< parameters.ruby-version >>
107
+ steps:
108
+ - checkout
109
+ - ruby/install-deps:
110
+ bundler-version: "2.3.5"
111
+ with-cache: false
112
+ path: './vendor/custom_bundle'
113
+ - <<: *system_dependencies
114
+ - run:
115
+ name: Running compatibility tests
116
+ command: bundle exec rspec
117
+
118
+ workflows:
119
+ build_and_test:
120
+ jobs:
121
+ - linters-ruby:
122
+ matrix:
123
+ parameters:
124
+ ruby-version: ["2.5"]
125
+ - tests-ruby:
126
+ matrix:
127
+ parameters:
128
+ ruby-version: ["2.5"]
129
+ - compatibility-ruby:
130
+ matrix:
131
+ parameters:
132
+ ruby-version: ["2.6", "2.7", "3.0", "3.1"]
data/.codeclimate.yml ADDED
@@ -0,0 +1,13 @@
1
+ checks:
2
+ argument-count:
3
+ enabled: false
4
+ method-complexity:
5
+ enabled: false
6
+
7
+ plugins:
8
+ rubocop:
9
+ enabled: true
10
+ channel: rubocop-1-24
11
+
12
+ reek:
13
+ enabled: true
@@ -0,0 +1,36 @@
1
+ # Branch naming convention
2
+
3
+ ## Branch naming
4
+
5
+ > Please note for new pull requests create new branches from current `develop` branch only.
6
+
7
+ Branch name should include type of your contribution and context. Please follow next pattern for naming your branches:
8
+
9
+ ```bash
10
+ feature/add-some-feature
11
+ technical/some-technical-improvements
12
+ bugfix/fix-some-bug-name
13
+ ```
14
+
15
+ ## Before PR actions
16
+
17
+ ### Squash commits
18
+
19
+ Please squash all branch commits into the one before openning your PR from your fork. It's simple to do with the git:
20
+
21
+ ```bash
22
+ git rebase -i [hash your first commit of your branch]~1
23
+ git rebase -i 6467fe36232401fa740af067cfd8ac9ec932fed2~1 # example
24
+ ```
25
+
26
+ ### Add commit description
27
+
28
+ Please complete your commit description folowing next pattern:
29
+
30
+ ```
31
+ Technical/Add info files # should be the same name as your branch name
32
+
33
+ * Added license, changelog, contributing, code of conduct docs
34
+ * Added GitHub templates
35
+ * Updated project license link
36
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: "[BUG] Your bug report title here"
5
+ labels: bug
6
+ assignees: bestwebua
7
+
8
+ ---
9
+
10
+ <!-- Thanks for helping to make SmtpMock better! Before submit your bug, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
11
+
12
+ ### New bug checklist
13
+
14
+ - [ ] I have updated `dns_mock` to the latest version
15
+ - [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-smtp-mock/blob/master/CONTRIBUTING.md)
16
+ - [ ] I have read the [documentation](https://github.com/mocktools/ruby-smtp-mock/blob/master/README.md)
17
+ - [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-smtp-mock/issues)
18
+
19
+ <!-- Please use next pattern for your bug report title: [BUG] Your bug report title here -->
20
+
21
+ ### Bug description
22
+ <!-- Please include what's happening, expected behavior, and any relevant code samples -->
23
+
24
+ ##### Complete output when running dns_mock, including the stack trace and command used
25
+
26
+ <details>
27
+ <pre>[INSERT OUTPUT HERE]</pre>
28
+ </details>
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for SmtpMock
4
+ title: "[FEATURE] Your feature request title here"
5
+ labels: enhancement
6
+ assignees: bestwebua
7
+
8
+ ---
9
+
10
+ <!-- Thanks for helping to make SmtpMock better! Before submit your new feature request, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
11
+
12
+ ### New feature request checklist
13
+
14
+ - [ ] I have updated `dns_mock` to the latest version
15
+ - [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-smtp-mock/blob/master/CONTRIBUTING.md)
16
+ - [ ] I have read the [documentation](https://github.com/mocktools/ruby-smtp-mock/blob/master/README.md)
17
+ - [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-smtp-mock/issues)
18
+
19
+ <!-- Please use next pattern for your feature request title: [FEATURE] Your feature request title here -->
20
+
21
+ ### Feature description
22
+
23
+ <!-- Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
24
+
25
+ Describe the solution you'd like. A clear and concise description of what you want to happen.
26
+
27
+ Describe alternatives you've considered. A clear and concise description of any alternative solutions or features you've considered. -->
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Issue report
3
+ about: Create a report to help us improve
4
+ title: "[ISSUE] Your issue report title here"
5
+ labels: ''
6
+ assignees: bestwebua
7
+
8
+ ---
9
+
10
+ <!-- Thanks for helping to make SmtpMock better! Before submit your issue, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
11
+
12
+ ### New issue checklist
13
+
14
+ - [ ] I have updated `dns_mock` to the latest version
15
+ - [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-smtp-mock/blob/master/CONTRIBUTING.md)
16
+ - [ ] I have read the [documentation](https://github.com/mocktools/ruby-smtp-mock/blob/master/README.md)
17
+ - [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-smtp-mock/issues)
18
+
19
+ <!-- Please use next pattern for your issue report title: [ISSUE] Your issue report title here -->
20
+
21
+ ### Issue description
22
+ <!-- Please include what's happening, expected behavior, and any relevant code samples -->
23
+
24
+ ##### Complete output when running dns_mock, including the stack trace and command used
25
+
26
+ <details>
27
+ <pre>[INSERT OUTPUT HERE]</pre>
28
+ </details>
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: Question
3
+ about: Ask your question to SmtpMock team
4
+ title: "[QUESTION] Your question title here"
5
+ labels: question
6
+ assignees: bestwebua
7
+
8
+ ---
9
+
10
+ <!-- Thanks for helping to make SmtpMock better! Before submit your question, please make sure to check the following boxes by putting an x in the [ ] (don't: [x ], [ x], do: [x]) -->
11
+
12
+ ### New question checklist
13
+
14
+ - [ ] I have read the [Contribution Guidelines](https://github.com/mocktools/ruby-smtp-mock/blob/master/CONTRIBUTING.md)
15
+ - [ ] I have read the [documentation](https://github.com/mocktools/ruby-smtp-mock/blob/master/README.md)
16
+ - [ ] I have searched for [existing GitHub issues](https://github.com/mocktools/ruby-smtp-mock/issues)
17
+
18
+ <!-- Please use next pattern for your question title: [QUESTION] Your question title here -->
19
+
20
+ ### Question
21
+
22
+ <!-- Your question context here -->
@@ -0,0 +1,49 @@
1
+ # PR Details
2
+
3
+ <!-- Provide a general summary of your changes in the Title above -->
4
+ <!-- PR name should the same name as your branch name, example: -->
5
+ <!-- Branch name is: feature/add-some-feature -->
6
+ <!-- PR name should be: Feature/Add some feature -->
7
+
8
+ ## Description
9
+
10
+ <!--- Describe your changes in detail -->
11
+
12
+ ## Related Issue
13
+
14
+ <!--- This project only accepts pull requests related to open issues -->
15
+ <!--- If suggesting a new feature or change, please discuss it in an issue first -->
16
+ <!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
17
+ <!--- Please link to the issue here: -->
18
+
19
+ ## Motivation and Context
20
+
21
+ <!--- Why is this change required? What problem does it solve? -->
22
+
23
+ ## How Has This Been Tested
24
+
25
+ <!--- Please describe in detail how you tested your changes. -->
26
+ <!--- Include details of your testing environment, and the tests you ran to -->
27
+ <!--- see how your change affects other areas of the code, etc. -->
28
+
29
+ ## Types of changes
30
+
31
+ <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
32
+
33
+ - [ ] Docs change / refactoring / dependency upgrade
34
+ - [ ] Bug fix (non-breaking change which fixes an issue)
35
+ - [ ] New feature (non-breaking change which adds functionality)
36
+ - [ ] Breaking change (fix or feature that would cause existing functionality to change)
37
+
38
+ ## Checklist
39
+
40
+ <!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
41
+ <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
42
+
43
+ - [ ] My code follows the code style of this project
44
+ - [ ] My change requires a change to the documentation
45
+ - [ ] I have updated the documentation accordingly
46
+ - [ ] I have read the [**CONTRIBUTING** document](https://github.com/mocktools/ruby-smtp-mock/blob/master/CONTRIBUTING.md)
47
+ - [ ] I have added tests to cover my changes
48
+ - [ ] I have run `bundle exec rspec` from the root directory to see all new and existing tests pass
49
+ - [ ] I have run `rubocop` and `reek` to ensure the code style is valid
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/err_log
9
+ /bin/smtpmock
10
+ .rspec_status
11
+ .DS_Store
12
+ Gemfile.lock
data/.overcommit.yml ADDED
@@ -0,0 +1,32 @@
1
+ PreCommit:
2
+ AuthorEmail:
3
+ enabled: true
4
+ required: false
5
+
6
+ AuthorName:
7
+ enabled: false
8
+
9
+ BundleAudit:
10
+ enabled: true
11
+
12
+ Fasterer:
13
+ enabled: true
14
+ include: '**/*.rb'
15
+
16
+ TrailingWhitespace:
17
+ enabled: true
18
+
19
+ RuboCop:
20
+ enabled: true
21
+ flags: ['--format=emacs', '--force-exclusion', '--display-cop-names']
22
+
23
+ Reek:
24
+ enabled: true
25
+ flags: ['--force-exclusion']
26
+
27
+ PostCheckout:
28
+ ALL:
29
+ quiet: true
30
+
31
+ IndexTags:
32
+ enabled: true
data/.reek.yml ADDED
@@ -0,0 +1,30 @@
1
+ detectors:
2
+ IrresponsibleModule:
3
+ enabled: false
4
+
5
+ UtilityFunction:
6
+ exclude:
7
+ - SmtpMock::CommandLineArgsBuilder#to_camel_case
8
+ - SmtpMock::DependencyHelper#compose_command
9
+ - SmtpMock::ServerHelper
10
+ - SmtpMock::TestFramework::RSpec::Helper#smtp_mock_server
11
+ - SmtpMock::ContextGeneratorHelper#random_message
12
+
13
+ NestedIterators:
14
+ exclude:
15
+ - SmtpMock::CommandLineArgsBuilder#define_attribute
16
+ - SmtpMock::Cli::Resolver#resolve
17
+
18
+ TooManyStatements:
19
+ exclude:
20
+ - SmtpMock::Cli::Resolver#resolve
21
+ - SmtpMock::Server#run
22
+ - SmtpMock::ServerHelper#create_fake_servers
23
+
24
+ TooManyInstanceVariables:
25
+ exclude:
26
+ - SmtpMock::Server
27
+
28
+ LongParameterList:
29
+ exclude:
30
+ - SmtpMock::ClientHelper#smtp_request
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color