fishbone 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: ed9085afa3cbba6930818dced99a46cedb93ad61
4
- data.tar.gz: 7419968a1b1138b24ca258bd3e5c468630e5f9c6
3
+ metadata.gz: f0476e97df08bef962373108e58ffb808e6079b9
4
+ data.tar.gz: c95b4769fbba986bc5644eeaf053682169e54616
5
5
  SHA512:
6
- metadata.gz: e851829ea005b604f6fbdcbe407bf55deb8f3f90633016970c9af3f422781e04fd638adebe0331beb10ee4edf97bdd371e84060552336213c1bd06300d22f820
7
- data.tar.gz: c90c65cda117c0d10bbb76c8f282c5d7b9af5a0db6ba32fa51a873f5219233db3a1e14f51dcf8471e702d57df1de9ac075473fae8ef83339499c2795a238d418
6
+ metadata.gz: ac891ff4ab8c943c2359e6ce038f89651e0a9549eeb2f6edfe2175d73e002ff8170cdacf76b11b27daf413a438a7067c12e79993f2676feaa4f371f2cb8bebba
7
+ data.tar.gz: 1da6521af9a185818618c371e061dfa1d163bc93b88711a5a2db3cdee9d4ffa0c52d90866cd3549a0562ab383dde08bbe58a8db91aecc9c44f3063f926b78d74
data/bin/setup CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bash
2
+
2
3
  set -euo pipefail
3
4
  IFS=$'\n\t'
4
5
  set -vx
data/exe/fishbone CHANGED
@@ -19,12 +19,12 @@ option_parser = OptionParser.new do |opts|
19
19
  Usage: #{executable_name} [options]
20
20
  "
21
21
 
22
- opts.on('-r', '--rspec', 'Generate an RSpec test suite based upon a template you have created.') do
23
- options[:rspec] = true
22
+ opts.on('-r', '--rspec STR', 'Generate an RSpec test suite based upon a template you have created.') do |spec_file|
23
+ raise "No template specified" if spec_file =~ /^-/
24
+ options[:rspec] = spec_file
24
25
  end
25
26
 
26
27
  opts.on('-c', '--capybara', 'Generate an Rspec test suite with capybara aliases') do
27
- options[:rspec] = true # automatically turn this one if capy is selected.
28
28
  options[:capybara] = true
29
29
  end
30
30
 
@@ -35,18 +35,17 @@ option_parser = OptionParser.new do |opts|
35
35
 
36
36
  opts.on('-z', '--object STR', 'Add an object to a repo and generate tests for it') do |obj|
37
37
  raise "No object provided" if obj =~ /^-/
38
- options[:rspec] = false
39
38
  options[:object] = obj
40
39
  end
41
40
 
42
- opts.on('-B', '--before-all', 'Include a before-all template for the given spec') do
43
- options[:rspec] = true
44
- options[:before_all] = true
41
+ opts.on('-B', '--before-all STR', 'Include a before-all template for the given spec') do |beforeall|
42
+ raise "No before-all templated provided" if beforeall =~ /^-/
43
+ options[:before_all] = beforeall
45
44
  end
46
45
 
47
- opts.on('-b', '--before-each', 'Include a before-each template for the given spec') do
48
- options[:rspec] = true
49
- options[:before_each] = true
46
+ opts.on('-b', '--before-each STR', 'Include a before-each template for the given spec') do |beforeeach|
47
+ raise "No before-each template provided" if beforeeach =~ /^-/
48
+ options[:before_each] = beforeeach
50
49
  end
51
50
 
52
51
  opts.on('-o', '--output STR', 'Write the generated code to a file') do |outfile|
@@ -54,7 +53,7 @@ option_parser = OptionParser.new do |opts|
54
53
  options[:output] = outfile
55
54
  end
56
55
 
57
- opts.on('-x', '--execute', 'Run the new file') do |runfile|
56
+ opts.on('-x', '--execute', 'Run the new file') do
58
57
  options[:runfile] = true
59
58
  end
60
59
 
@@ -79,5 +78,5 @@ else
79
78
  text_out = generator.spec if options[:rspec]
80
79
  puts generator.object if options[:object]
81
80
  generator.write_to_file(text_out) if options[:output]
82
- system("rspec #{options[:output]}")if options[:runfile]
81
+ system("rspec #{options[:output]}")if options[:runfile] && options[:output]
83
82
  end
data/lib/fishbone.rb CHANGED
@@ -21,25 +21,14 @@ module Fishbone
21
21
  hook = 'before'
22
22
  end
23
23
 
24
- simple_template = File.read(File.join root, 'lib/templates/specfile.erb')
25
- before_all_template = File.read(File.join root, 'lib/templates/before_all.erb') if @options[:before_all]
26
- before_each_template = File.read(File.join root, 'lib/templates/before_each.erb') if @options[:before_each]
24
+ feature_name = @options[:feature] || "Give your feature a name"
25
+ simple_template = File.read(@options[:rspec]) if @options[:rspec]
26
+ before_all_template = File.read(@options[:before_all]) if @options[:before_all]
27
+ before_each_template = File.read(@options[:before_each]) if @options[:before_each]
27
28
  renderer = ERB.new(simple_template)
28
29
  renderer.result(binding)
29
30
  end
30
31
 
31
- def turnip_step
32
- "generate a turnip step here"
33
- end
34
-
35
- def feature
36
- "generate a feature name for your test suite"
37
- end
38
-
39
- def scenarios
40
- "generate some scenarios"
41
- end
42
-
43
32
  def write_to_file(text_out)
44
33
  file = @options[:output]
45
34
  File.write(file, text_out)
@@ -1,3 +1,3 @@
1
1
  module Fishbone
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper.rb'
2
2
 
3
- <%= level_one %> 'feature one' do
3
+ <%= level_one %> '<%= feature_name %>' do
4
4
  <%= hook %>(:all) do
5
5
  <%= before_all_template %>
6
6
  binding.pry
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fishbone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason McInerney