space2underscore 0.5.3 → 0.6.1

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
2
  SHA256:
3
- metadata.gz: 5405706c2105ac418843695f1d7afd044b9564ed685af0c6f8fa154553eb206e
4
- data.tar.gz: 706848adbf574a43e1d99627e00e09fbd207e504dd516b25ccbea5e62f71d69e
3
+ metadata.gz: dba1ba27849c81429c896976c2b3b0cc958742f16dc5f0588280aeca3f1a9ddb
4
+ data.tar.gz: 5fb0b0dba5cf58ac7b61e4f3309e700780d3f07f2b1848da33cc5d9163bc09e2
5
5
  SHA512:
6
- metadata.gz: 868566a30e93b631a124e6493f9b7016db45975097ce2c0d6aa17bc14b420208d31dc84bdeea91fe96084117c3a6025576f214782aedbf21668266471d4f9ce3
7
- data.tar.gz: a19420ddb6a53121649889f839f537a793193ffddea28e8b84706c110287de23f40c2f5ed14141cf405eaacfd37a68d24881f51f57d8f55737b918f29db7cd73
6
+ metadata.gz: a2694fe66f5dc84dbe708eea7fcc14f56b6e5828ba92f860663a1aae5fed6e8133f617827bc72fc9b8a73340ba69dfb4b759404037a368584f5391cd9828fe67
7
+ data.tar.gz: 9887708fc1716e3d71cd3395b3ce7fe2b61a7b8e189d26d571e95515118fe85e067daec0d39b8504eeeb130512dbc9be463d4df4df1b7ed5eca91662e4c1a964
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Space2underscore Change Log
2
2
 
3
+ ## v0.6.1
4
+ - Bump minimum Ruby version to 2.7.
5
+ - Migrate from Travis CI to GitHub Actions.
6
+ - Modernize gem specification.
7
+ - Update RuboCop configuration with modern settings.
8
+ - Remove version constraint from Coveralls.
9
+ - Improve README with clearer structure and formatting.
10
+
11
+ ## v0.6.0
12
+ - Fix command injection vulnerability in Executor.
13
+ - Simplify architecture and remove Singleton pattern.
14
+ - Replace duplicate s2u with symlink.
15
+ - Add project configuration file.
16
+ - Fix typos in documentation.
17
+
3
18
  ## v0.5.2
4
19
  - Refactor methods in space2underscore.
5
20
  - Refactor examples for space2underscore.
data/README.md CHANGED
@@ -1,15 +1,19 @@
1
1
  # Space2underscore
2
2
 
3
- ![Gem Version](https://badge.fury.io/rb/space2underscore.svg) [![Build Status](https://travis-ci.org/sachin21/space2underscore.svg?branch=master)](https://travis-ci.org/sachin21/space2underscore) [![Code Climate](https://codeclimate.com/github/sachin21/space2underscore/badges/gpa.svg)](https://codeclimate.com/github/sachin21/space2underscore) [![Coverage Status](https://coveralls.io/repos/sachin21/space2underscore/badge.svg?branch=master&service=github)](https://coveralls.io/github/sachin21/space2underscore?branch=master) [![Gem](https://img.shields.io/gem/dt/space2underscore.svg)](https://rubygems.org/gems/space2underscore)
3
+ A CLI tool that converts spaces into underscores. Useful for creating or renaming Git branches.
4
4
 
5
- ## What is space2underscore
5
+ [![Gem Version](https://badge.fury.io/rb/space2underscore.svg)](https://badge.fury.io/rb/space2underscore)
6
+ [![CI](https://github.com/sachin21/space2underscore/workflows/CI/badge.svg)](https://github.com/sachin21/space2underscore/actions)
7
+ [![Code Climate](https://codeclimate.com/github/sachin21/space2underscore/badges/gpa.svg)](https://codeclimate.com/github/sachin21/space2underscore)
8
+ [![Coverage Status](https://coveralls.io/repos/sachin21/space2underscore/badge.svg?branch=master&service=github)](https://coveralls.io/github/sachin21/space2underscore?branch=master)
9
+ [![Gem Downloads](https://img.shields.io/gem/dt/space2underscore.svg)](https://rubygems.org/gems/space2underscore)
6
10
 
7
- Change the space into underscore.
8
- space2underscore is a useful command when you want to check out a branch.
11
+ ## Requirements
9
12
 
10
- ## Installation
13
+ - Ruby >= 2.4.0
14
+ - Git
11
15
 
12
- Install it yourself as:
16
+ ## Installation
13
17
 
14
18
  ```
15
19
  $ gem install space2underscore
@@ -17,28 +21,52 @@ $ gem install space2underscore
17
21
 
18
22
  ## Usage
19
23
 
20
- From the command line:
24
+ ### Create a new branch
21
25
 
22
- ### 1. e.g. Create the new branch
26
+ Use the `-c` (`--create`) option to create a new Git branch with spaces converted to underscores.
23
27
 
24
28
  ```
25
29
  $ s2u new branch -c
26
- => Switched to a new branch 'new_branch
30
+ => Switched to a new branch 'new_branch'
27
31
  ```
28
32
 
29
- Run with `--create` or `-c` options.
33
+ ### Rename an existing branch
30
34
 
31
- ### 2. e.g. Rename the already created a branch
35
+ Use `$(s2u ...)` as a subcommand.
32
36
 
33
37
  ```
34
38
  $ git branch -m $(s2u renamed branch)
35
39
  ```
36
40
 
37
- ## !! Cation !!
41
+ ### Print the converted string
42
+
43
+ Without any options, the converted string is printed to stdout. By default, the output is downcased.
44
+
45
+ ```
46
+ $ s2u Hello World
47
+ hello_world
48
+ ```
49
+
50
+ ### Preserve original case
51
+
52
+ Use the `-r` (`--raw`) option to keep the original letter casing.
53
+
54
+ ```
55
+ $ s2u Hello World -r
56
+ Hello_World
57
+ ```
58
+
59
+ ### Options
60
+
61
+ | Option | Short | Description |
62
+ |---|---|---|
63
+ | `--create` | `-c` | Create a new Git branch with the converted name |
64
+ | `--raw` | `-r` | Preserve original letter casing (skip downcase) |
65
+
66
+ ## Caution
67
+
68
+ This is a command line tool. **DO NOT** include this module in other Ruby applications, as it uses the `system` command internally, which may introduce command injection vulnerabilities.
38
69
 
39
- This is a command line tool. So DO NOT include space2underscore's module in other Ruby application because it uses `system` command.
40
- If you include this module to your application, there is a possibility of crackers attacking.
70
+ ## License
41
71
 
42
- ## Credits
43
- - Help information based on [@motemen's ghq](https://github.com/motemen/ghq)
44
- - Installed information based on [Tmuxinator](https://github.com/tmuxinator/tmuxinator)
72
+ [MIT License](MIT-LICENSE) - Copyright (c) 2014 Satoshi Ohmori
data/bin/s2u ADDED
@@ -0,0 +1 @@
1
+ space2underscore
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Space2underscore
4
+ # Creates git branches with secure command execution
5
+ class BranchCreator
6
+ class << self
7
+ # Create a new git branch with the given name
8
+ #
9
+ # @param name [String] Branch name to create
10
+ # @return [void]
11
+ # @raise [SystemExit] Exits with git command status code
12
+ def create(name)
13
+ # Use array form to prevent command injection
14
+ # Place branch name directly after -b as git requires,
15
+ # then -- to separate from any start-point ambiguity
16
+ exit system('git', 'checkout', '-b', name, '--')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,67 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Space2underscore
4
+ # Main CLI orchestrator
4
5
  class Cli
5
- CREATE_FLAGS = %w[-c --create].freeze
6
- RAW_FLAGS = %w[-r --raw].freeze
7
-
8
- FLAGS = [CREATE_FLAGS, RAW_FLAGS].flatten.freeze
9
-
10
- ERROR_MSG = 'Option is invalid format. It is only avaliable for `-c --create -d --downcase`'
11
-
12
- OptionParseError = Class.new(ArgumentError)
13
-
14
6
  def initialize(argv)
15
7
  @argv = argv
16
- @underscore_include_branch = Underscore.new(branch).convert
17
- @executer = Executor.instance
18
- @printer = Printer.instance
19
8
  end
20
9
 
21
10
  def start
22
- return $stdout.puts Usage.new.content if @argv.empty?
11
+ options = OptionsParser.parse(@argv)
23
12
 
24
- if with_all_flags?
25
- @executer.run_with_raw(@underscore_include_branch)
26
- elsif create_flags_without_raw_flags?
27
- @executer.run_with_downcase(@underscore_include_branch)
28
- elsif raw_flags_without_create_flags?
29
- @printer.run_with_raw(@underscore_include_branch)
30
- elsif without_any_flags?
31
- @printer.run_with_downcase(@underscore_include_branch)
32
- else
33
- raise OptionParseError, ERROR_MSG
34
- end
35
- end
13
+ # Show usage if no arguments
14
+ return display_usage unless options
36
15
 
37
- private
16
+ # Convert input to branch name
17
+ branch_name = Converter.convert(options.input)
38
18
 
39
- def branch
40
- @argv.reject { |arg| FLAGS.include?(arg) }
41
- end
19
+ # Apply case transformation
20
+ branch_name = branch_name.downcase if options.downcase
42
21
 
43
- def included?(flags)
44
- @argv.any? { |arg| flags.include?(arg) }
45
- end
46
-
47
- def not_included?(flags)
48
- !included?(flags)
49
- end
50
-
51
- def without_any_flags?
52
- not_included?(CREATE_FLAGS) && not_included?(RAW_FLAGS)
53
- end
54
-
55
- def with_all_flags?
56
- included?(CREATE_FLAGS) && included?(RAW_FLAGS)
22
+ # Execute action
23
+ case options.action
24
+ when :create
25
+ BranchCreator.create(branch_name)
26
+ when :print
27
+ OutputPrinter.print(branch_name)
28
+ end
29
+ rescue OptionsParser::ParseError => e
30
+ $stderr.puts "Error: #{e.message}"
31
+ exit 1
57
32
  end
58
33
 
59
- def create_flags_without_raw_flags?
60
- included?(CREATE_FLAGS) && not_included?(RAW_FLAGS)
61
- end
34
+ private
62
35
 
63
- def raw_flags_without_create_flags?
64
- included?(RAW_FLAGS) && not_included?(CREATE_FLAGS)
36
+ def display_usage
37
+ $stdout.puts Usage.new.content
65
38
  end
66
39
  end
67
40
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Space2underscore
4
+ # Converts spaces to underscores in branch names
5
+ class Converter
6
+ class << self
7
+ # Convert input to branch name with underscores
8
+ #
9
+ # @param input [Array<String>] Input words
10
+ # @return [String] Branch name with underscores
11
+ def convert(input)
12
+ return '' if input.empty?
13
+
14
+ if input.length == 1
15
+ # Single argument: "foo bar" -> "foo_bar"
16
+ input[0].strip.gsub(/\s+/, '_')
17
+ else
18
+ # Multiple arguments: ["foo", "bar"] -> "foo_bar"
19
+ input.join('_')
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Space2underscore
4
+ # Represents parsed command-line options
5
+ Options = Struct.new(:action, :input, :downcase, keyword_init: true)
6
+
7
+ # Parses command-line arguments into Options
8
+ class OptionsParser
9
+ CREATE_FLAGS = %w[-c --create].freeze
10
+ RAW_FLAGS = %w[-r --raw].freeze
11
+ ALL_FLAGS = (CREATE_FLAGS + RAW_FLAGS).freeze
12
+
13
+ ParseError = Class.new(ArgumentError)
14
+
15
+ class << self
16
+ # Parse argv into Options object
17
+ #
18
+ # @param argv [Array<String>] Command-line arguments
19
+ # @return [Options, nil] Parsed options or nil if empty
20
+ # @raise [ParseError] If arguments are invalid
21
+ def parse(argv)
22
+ return nil if argv.empty? # Triggers usage display
23
+
24
+ has_create = argv.any? { |arg| CREATE_FLAGS.include?(arg) }
25
+ has_raw = argv.any? { |arg| RAW_FLAGS.include?(arg) }
26
+ input = argv.reject { |arg| ALL_FLAGS.include?(arg) }
27
+
28
+ validate_input!(input)
29
+
30
+ Options.new(
31
+ action: has_create ? :create : :print,
32
+ input: input,
33
+ downcase: !has_raw # raw flag means preserve case
34
+ )
35
+ end
36
+
37
+ private
38
+
39
+ def validate_input!(input)
40
+ raise ParseError, 'Branch name is required' if input.empty?
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Space2underscore
4
+ # Prints branch names to stdout
5
+ class OutputPrinter
6
+ class << self
7
+ # Print branch name to stdout
8
+ #
9
+ # @param name [String] Branch name to print
10
+ # @return [void]
11
+ def print(name)
12
+ $stdout.puts name
13
+ end
14
+ end
15
+ end
16
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # This module holds the Space2underscore version information.
4
4
  module Space2underscore
5
- VERSION = '0.5.3'
5
+ VERSION = '0.6.1'
6
6
  end
@@ -7,8 +7,9 @@ end
7
7
  require 'singleton'
8
8
 
9
9
  require 'space2underscore/version'
10
- require 'space2underscore/executor'
11
- require 'space2underscore/printer'
12
- require 'space2underscore/underscore'
10
+ require 'space2underscore/options_parser'
11
+ require 'space2underscore/converter'
12
+ require 'space2underscore/output_printer'
13
+ require 'space2underscore/branch_creator'
13
14
  require 'space2underscore/usage'
14
15
  require 'space2underscore/cli'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: space2underscore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sachin21
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2019-05-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -70,16 +69,16 @@ dependencies:
70
69
  name: rubocop
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
- - - "<"
72
+ - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: 0.49.0
74
+ version: '1.0'
76
75
  type: :development
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
- - - "<"
79
+ - - "~>"
81
80
  - !ruby/object:Gem::Version
82
- version: 0.49.0
81
+ version: '1.0'
83
82
  description: Change the space into underscore
84
83
  email:
85
84
  - sachin21dev@gmail.com
@@ -89,34 +88,26 @@ executables:
89
88
  extensions: []
90
89
  extra_rdoc_files: []
91
90
  files:
92
- - ".gitignore"
93
- - ".rspec"
94
- - ".rubocop.yml"
95
- - ".travis.yml"
96
91
  - CHANGELOG.md
97
- - Gemfile
98
92
  - MIT-LICENSE
99
93
  - README.md
100
- - Rakefile
101
94
  - bin/s2u
102
95
  - bin/space2underscore
103
96
  - lib/space2underscore.rb
97
+ - lib/space2underscore/branch_creator.rb
104
98
  - lib/space2underscore/cli.rb
105
- - lib/space2underscore/executor.rb
106
- - lib/space2underscore/printer.rb
107
- - lib/space2underscore/underscore.rb
99
+ - lib/space2underscore/converter.rb
100
+ - lib/space2underscore/options_parser.rb
101
+ - lib/space2underscore/output_printer.rb
108
102
  - lib/space2underscore/usage.rb
109
103
  - lib/space2underscore/version.rb
110
104
  - post_install_message.txt
111
- - space2underscore.gemspec
112
- - spec/space2underscore/printer_spec.rb
113
- - spec/space2underscore/underscore_spec.rb
114
- - spec/space2underscore/usage_spec.rb
115
- - spec/spec_helper.rb
116
105
  homepage: https://github.com/sachin21/space2underscore
117
106
  licenses:
118
107
  - MIT
119
- metadata: {}
108
+ metadata:
109
+ bug_tracker_uri: https://github.com/sachin21/space2underscore/issues
110
+ source_code_uri: https://github.com/sachin21/space2underscore
120
111
  post_install_message: |
121
112
  ..........................................................
122
113
  __________________________________________________________
@@ -143,20 +134,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
134
  requirements:
144
135
  - - ">="
145
136
  - !ruby/object:Gem::Version
146
- version: 2.3.0
137
+ version: 2.7.0
147
138
  required_rubygems_version: !ruby/object:Gem::Requirement
148
139
  requirements:
149
140
  - - ">="
150
141
  - !ruby/object:Gem::Version
151
142
  version: '0'
152
143
  requirements: []
153
- rubyforge_project:
154
- rubygems_version: 2.7.6
155
- signing_key:
144
+ rubygems_version: 4.0.4
156
145
  specification_version: 4
157
146
  summary: Change the space into underscore
158
- test_files:
159
- - spec/space2underscore/printer_spec.rb
160
- - spec/space2underscore/underscore_spec.rb
161
- - spec/space2underscore/usage_spec.rb
162
- - spec/spec_helper.rb
147
+ test_files: []
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- InstalledFiles
7
- _yardoc
8
- coverage
9
- doc/
10
- lib/bundler/man
11
- pkg
12
- rdoc
13
- spec/reports
14
- test/tmp
15
- test/version_tmp
16
- tmp
17
- /vendor
18
- Gemfile.lock
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format progress
data/.rubocop.yml DELETED
@@ -1,16 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.3
3
-
4
- Exclude:
5
- - 'vendor/bundle/**/*'
6
-
7
- DisplayCopNames: true
8
-
9
- Style/Documentation:
10
- Enabled: false
11
-
12
- Metrics/LineLength:
13
- Max: 100
14
-
15
- Metrics/MethodLength:
16
- Max: 15
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.3.7
5
- - 2.4.4
6
- - 2.5.1
7
- - ruby-head
8
-
9
- before_install:
10
- - gem install bundler
11
- - rm -f .git/index.lock
12
-
13
- script: "bundle exec rake spec:with_coveralls"
14
-
15
- notifications:
16
- email: false
17
- slack: sachin21dev:3pEyff2UFnoCgl4NI0uxbsER
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- gem 'coveralls', '0.8.3', require: false
data/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- gem_helper = Bundler::GemHelper.new
9
-
10
- desc "Create tag #{gem_helper.send(:version_tag)}"
11
- task :tag do
12
- gem_helper.send(:tag_version) unless gem_helper.send(:already_tagged?)
13
- end
14
-
15
- task default: :spec
16
-
17
- namespace :spec do
18
- desc 'Run RSpec with Coveralls'
19
- task :with_coveralls do
20
- ENV['COVERALLS'] = 'true'
21
- Rake::Task['spec'].execute
22
- end
23
- end
data/bin/s2u DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'space2underscore'
5
-
6
- Space2underscore::Cli.new(ARGV).start
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Space2underscore
4
- class Executor
5
- include Singleton
6
-
7
- def run_with_raw(underscore_include_sentence)
8
- run underscore_include_sentence
9
- end
10
-
11
- def run_with_downcase(underscore_include_sentence)
12
- run underscore_include_sentence.downcase
13
- end
14
-
15
- private
16
-
17
- def run(sentence)
18
- exit system "git checkout -b #{sentence}"
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Space2underscore
4
- class Printer
5
- include Singleton
6
-
7
- def run_with_raw(branch)
8
- run branch
9
- end
10
-
11
- def run_with_downcase(branch)
12
- run branch.downcase
13
- end
14
-
15
- private
16
-
17
- def run(branch)
18
- $stdout.puts branch
19
- end
20
- end
21
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Space2underscore
4
- class Underscore
5
- def initialize(sentence)
6
- @sentence = sentence
7
- end
8
-
9
- def convert
10
- if @sentence.length == 1
11
- @sentence[0].strip.gsub(/\s/, '_')
12
- else
13
- @sentence.join('_')
14
- end
15
- end
16
- end
17
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('../lib', __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'space2underscore/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'space2underscore'
9
- spec.version = Space2underscore::VERSION
10
- spec.authors = ['sachin21']
11
- spec.email = ['sachin21dev@gmail.com']
12
- spec.description = 'Change the space into underscore'
13
- spec.summary = 'Change the space into underscore'
14
- spec.homepage = 'https://github.com/sachin21/space2underscore'
15
- spec.license = 'MIT'
16
-
17
- spec.files = `git ls-files`.split($RS)
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ['lib']
21
- spec.required_ruby_version = '>= 2.3.0'
22
-
23
- spec.post_install_message = File.read('post_install_message.txt')
24
-
25
- spec.add_development_dependency 'bundler'
26
- spec.add_development_dependency 'rake'
27
- spec.add_development_dependency 'rspec'
28
- spec.add_development_dependency 'pry'
29
- spec.add_development_dependency 'rubocop', '< 0.49.0'
30
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Space2underscore::Printer do
6
- let(:branch) { 'FOO_bar' }
7
-
8
- describe '#run_with_raw' do
9
- subject { -> { described_class.instance.run_with_raw(branch) } }
10
-
11
- it { is_expected.to output(/FOO_bar/).to_stdout }
12
- end
13
-
14
- describe '#run_with_downcase' do
15
- subject { -> { described_class.instance.run_with_downcase(branch) } }
16
-
17
- it { is_expected.to output(/foo_bar/).to_stdout }
18
- end
19
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'open3'
5
-
6
- describe Space2underscore::Underscore do
7
- describe '#convert' do
8
- subject { described_class.new(argument).convert }
9
-
10
- context 'when number of argument is one' do
11
- let(:argument) { ['foo bar'] }
12
-
13
- it { is_expected.to include('_') }
14
- end
15
-
16
- context 'when number of argument is many' do
17
- let(:argument) { %w[foo bar] }
18
-
19
- it { is_expected.to include('_') }
20
- end
21
- end
22
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Space2underscore::Usage do
6
- subject { described_class.new.content }
7
-
8
- it { is_expected.to be_a String }
9
- it { is_expected.not_to be_empty }
10
- end
data/spec/spec_helper.rb DELETED
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'space2underscore'
4
-
5
- if ENV['COVERALLS']
6
- require 'coveralls'
7
- Coveralls.wear!
8
- end
9
-
10
- Bundler.setup
11
-
12
- RSpec.configure do |config|
13
- config.order = 'random'
14
- config.expect_with :rspec do |rspec|
15
- rspec.syntax = :expect
16
- end
17
- end