fishbone 0.1.2 → 0.1.3

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: a6d5737d42d7cad10cb94a5bfa5ed2fabd8b3f17
4
- data.tar.gz: 37795c8cf76d26126b85b710fc2b1dce835dc170
3
+ metadata.gz: 1b7d68d42ab0b27261477121b3d72295e17e21cd
4
+ data.tar.gz: bc316be5bb63a408be7154761f11e0c8c4e79185
5
5
  SHA512:
6
- metadata.gz: 98961c3441de82feee130e41e1efc3530a5c1f934260ba65c7aa7c5ed72005d3fae6585314a602a675774c4defc0ff0a45ebd4726bbe75f19418fd7a257c08f6
7
- data.tar.gz: 9f84cb3f9eb307d5541218dd0b7caedb99cfaa3c264e105a0375e956db1ec4a945296ad8bb46eb0dcc5a36657289efa0097a4e4759fd4b365f143d832a2b3e14
6
+ metadata.gz: adf77967c73b09efe9312c787a0db312746546604c87957211bc71205cfb5c4cb7ca9f8493faef23839119245ea0358549f77262a27d52ace494c2ed626f77e9
7
+ data.tar.gz: 3ec5546c66c0f1f415feb7277cd07f00173e8f2f19671c9c5661062513e2b7e5741fea6aa1201769d84fdb60c907b93147827144751c9b44a84de1cae23a5802
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Fishbone
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/fishbone.svg)](https://badge.fury.io/rb/fishbone)
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/jasonmci/fishbone/master/LICENSE.txt)
5
+ [![Twitter](https://img.shields.io/twitter/url/https/github.com/jasonmci/fishbone.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=%5Bobject%20Object%5D)
4
6
 
5
7
  I wanted something to jumpstart automated tests, and I liked how rails generates scaffolding from the commandline. Bringing those two ideas together, I created a fishbone commandline tool to generate some scaffolding; consistent, intuitive, and easily configurable for any test automation professional.
6
8
 
data/exe/fishbone CHANGED
@@ -34,7 +34,7 @@ option_parser = OptionParser.new do |opts|
34
34
  options[:scenarios] = name
35
35
  end
36
36
 
37
- opts.on('-o', '--object STR', 'Add an object to a repo and generate tests for it') do |obj|
37
+ opts.on('-z', '--object STR', 'Add an object to a repo and generate tests for it') do |obj|
38
38
  raise "No object provided" if obj =~ /^-/
39
39
  options[:object] = obj
40
40
  end
@@ -44,6 +44,21 @@ option_parser = OptionParser.new do |opts|
44
44
  options[:edge] = edge
45
45
  end
46
46
 
47
+ opts.on('-B', '--before-all', 'Include a before-all template for the given spec') do |edge|
48
+ raise "No page object provided" if edge =~ /^-/
49
+ options[:before_all] = true
50
+ end
51
+
52
+ opts.on('-b', '--before-each', 'Include a before-each template for the given spec') do |edge|
53
+ raise "No page object provided" if edge =~ /^-/
54
+ options[:before_each] = true
55
+ end
56
+
57
+ opts.on('-o', '--output STR', 'Write the generated code to a file') do |outfile|
58
+ raise "No page object provided" if outfile =~ /^-/
59
+ options[:output] = outfile
60
+ end
61
+
47
62
  end
48
63
 
49
64
  begin
@@ -62,6 +77,8 @@ if options.empty?
62
77
  else
63
78
  generator = Fishbone::Generator.new(options)
64
79
  puts generator.spec if options[:rspec]
80
+ text_out = generator.spec if options[:rspec]
65
81
  puts generator.object if options[:object]
66
82
  puts generator.edge if options[:edge]
83
+ generator.write_to_file(text_out) if options[:output]
67
84
  end
@@ -1,3 +1,3 @@
1
1
  module Fishbone
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/fishbone.rb CHANGED
@@ -17,6 +17,8 @@ module Fishbone
17
17
  level_two = 'it'
18
18
  hook = 'before'
19
19
  end
20
+ before_all_template = File.read('./lib/templates/before_all.erb') if @options[:before_all]
21
+ before_each_template = File.read('./lib/templates/before_each.erb') if @options[:before_each]
20
22
  simple_template = File.read('./lib/templates/specfile.erb')
21
23
  renderer = ERB.new(simple_template)
22
24
  renderer.result(binding)
@@ -34,6 +36,11 @@ module Fishbone
34
36
  "generate some scenarios"
35
37
  end
36
38
 
39
+ def write_to_file(text_out)
40
+ file = @options[:output]
41
+ File.write(file, text_out)
42
+ end
43
+
37
44
  def edge
38
45
  obj_def = @options[:object]
39
46
  edge_template = File.read('./lib/templates/edge.erb')
@@ -0,0 +1 @@
1
+ # before all!
@@ -0,0 +1 @@
1
+ # before each!
@@ -2,9 +2,11 @@ require 'spec_helper.rb'
2
2
 
3
3
  <%= level_one %> 'feature one' do
4
4
  <%= hook %>(:all) do
5
+ <%= before_all_template %>
5
6
  end
6
7
 
7
8
  <%= hook %>(:each) do
9
+ <%= before_each_template %>
8
10
  end
9
11
 
10
12
  <%= level_two %> 'scenario one' do
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason McInerney
@@ -76,6 +76,8 @@ files:
76
76
  - fishbone.gemspec
77
77
  - lib/fishbone.rb
78
78
  - lib/fishbone/version.rb
79
+ - lib/templates/before_all.erb
80
+ - lib/templates/before_each.erb
79
81
  - lib/templates/edge.erb
80
82
  - lib/templates/object.erb
81
83
  - lib/templates/specfile.erb