fishbone 0.1.7 → 0.1.8
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 +4 -4
- data/.fishbone +1 -1
- data/Gemfile +2 -0
- data/exe/fishbone +20 -5
- data/lib/fishbone.rb +34 -13
- data/lib/fishbone/version.rb +1 -1
- data/lib/templates/before_all.erb +1 -1
- data/lib/templates/edge.erb +3 -4
- data/lib/templates/simple.erb +31 -0
- data/lib/templates/specfile.erb +9 -5
- data/lib/templates/table.erb +15 -0
- data/outfile.rb +54 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8cacd89aa80ba1002950e73b70753d11e381f404
|
|
4
|
+
data.tar.gz: 00aca1c67d63495b844d5e0b570213c3fdd1bf5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 587701a01735445aa425e91378bce17d90492987cd5ddf276e38d8a995ccf242c70cb34e40c52c9a0b4b477dc8f5b594bec5c0fff3cfbec088fbcf2440e51fc7
|
|
7
|
+
data.tar.gz: a5058f9fc70a0e055929b34c96a39937529f0d93f97056cf72cf6677e205411ce91669af80b8cdf250696c660fb61e80101757008a6c80bac68ab3137e154527
|
data/.fishbone
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
-
|
|
1
|
+
-r ./lib/templates/specfile.erb -c -b ./lib/templates/before_each.erb -B ./lib/templates/before_all.erb -e ./lib/templates/edge.erb
|
data/Gemfile
CHANGED
data/exe/fishbone
CHANGED
|
@@ -10,7 +10,7 @@ option_parser = OptionParser.new do |opts|
|
|
|
10
10
|
executable_name = File.basename($PROGRAM_NAME)
|
|
11
11
|
|
|
12
12
|
if opts.default_argv.empty? && File.exist?('.fishbone')
|
|
13
|
-
opts.default_argv.push File.read('.fishbone')
|
|
13
|
+
opts.default_argv.push "#{File.read('.fishbone')}"
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
opts.banner = "
|
|
@@ -53,10 +53,24 @@ option_parser = OptionParser.new do |opts|
|
|
|
53
53
|
options[:output] = outfile
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
opts.on('-e', '--edge STR', 'Add some suggested edge cases') do |edges|
|
|
57
|
+
raise "No file name provided" if edges =~ /^-/
|
|
58
|
+
options[:edge] = edges
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
opts.on('-s', '--simple STR', 'Add some simple scenarios') do |simple|
|
|
62
|
+
raise "No file name provided" if simple =~ /^-/
|
|
63
|
+
options[:simple] = simple
|
|
64
|
+
end
|
|
65
|
+
|
|
56
66
|
opts.on('-x', '--execute', 'Run the new file') do
|
|
57
67
|
options[:runfile] = true
|
|
58
68
|
end
|
|
59
69
|
|
|
70
|
+
opts.on('-t', '--table', 'Add a set of table-related tests') do
|
|
71
|
+
options[:table_tests] = true
|
|
72
|
+
end
|
|
73
|
+
|
|
60
74
|
end
|
|
61
75
|
|
|
62
76
|
begin
|
|
@@ -74,9 +88,10 @@ if options.empty?
|
|
|
74
88
|
puts option_parser.help
|
|
75
89
|
else
|
|
76
90
|
generator = Fishbone::Generator.new(options)
|
|
77
|
-
puts generator.
|
|
78
|
-
|
|
91
|
+
puts generator.table_tests if options[:table]
|
|
92
|
+
puts generator.make_spec(options) if options[:rspec]
|
|
93
|
+
text_out = generator.make_spec(options) if options[:rspec]
|
|
79
94
|
puts generator.object if options[:object]
|
|
80
95
|
generator.write_to_file(text_out) if options[:output]
|
|
81
|
-
system("rspec #{options[:output]}")if options[:runfile] && options[:output]
|
|
82
|
-
end
|
|
96
|
+
puts system("rspec #{options[:output]}")if options[:runfile] && options[:output]
|
|
97
|
+
end
|
data/lib/fishbone.rb
CHANGED
|
@@ -10,22 +10,23 @@ module Fishbone
|
|
|
10
10
|
File.expand_path '../..', __FILE__
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def
|
|
14
|
-
if
|
|
15
|
-
|
|
16
|
-
level_two = 'scenario'
|
|
17
|
-
hook = 'background'
|
|
13
|
+
def aliases(options)
|
|
14
|
+
if options[:capybara]
|
|
15
|
+
capybara_aliases
|
|
18
16
|
else
|
|
19
|
-
|
|
20
|
-
level_two = 'it'
|
|
21
|
-
hook = 'before'
|
|
17
|
+
spec_aliases
|
|
22
18
|
end
|
|
19
|
+
end
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
def make_spec(options)
|
|
22
|
+
local_aliases = aliases(options)
|
|
23
|
+
feature_name = options[:feature] || "Give your feature a name"
|
|
24
|
+
base_template = File.read(options[:rspec]) if options[:rspec]
|
|
25
|
+
before_all_template = File.read(options[:before_all]) if options[:before_all]
|
|
26
|
+
before_each_template = File.read(options[:before_each]) if options[:before_each]
|
|
27
|
+
edge_template = File.read(options[:edge]) if options[:edge]
|
|
28
|
+
simple_template = File.read(options[:simple]) if options[:simple]
|
|
29
|
+
renderer = ERB.new(base_template)
|
|
29
30
|
renderer.result(binding)
|
|
30
31
|
end
|
|
31
32
|
|
|
@@ -41,6 +42,26 @@ module Fishbone
|
|
|
41
42
|
renderer.result(binding)
|
|
42
43
|
end
|
|
43
44
|
|
|
45
|
+
def spec_aliases
|
|
46
|
+
{ :level_one => 'describe',
|
|
47
|
+
:level_two => 'it',
|
|
48
|
+
:hook => 'before'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def capybara_aliases
|
|
53
|
+
{ :level_one => 'feature',
|
|
54
|
+
:level_two => 'scenario',
|
|
55
|
+
:hook => 'background'
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def table_tests
|
|
60
|
+
local_aliases = aliases(@options)
|
|
61
|
+
test_def_template = File.read('./lib/templates/table.erb')
|
|
62
|
+
renderer = ERB.new(test_def_template)
|
|
63
|
+
renderer.result(binding)
|
|
64
|
+
end
|
|
44
65
|
end
|
|
45
66
|
end
|
|
46
67
|
|
data/lib/fishbone/version.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# before all
|
|
1
|
+
# before all
|
data/lib/templates/edge.erb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
end
|
|
4
|
-
|
|
1
|
+
it 'is required' do
|
|
2
|
+
expect(nil).to be_nil
|
|
3
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
it 'opens something' do
|
|
2
|
+
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
it 'closes something' do
|
|
6
|
+
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'expands something' do
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'collapses' do
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'sorts ascending' do
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'sorts descending' do
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'exists' do
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'does not exist' do
|
|
30
|
+
|
|
31
|
+
end
|
data/lib/templates/specfile.erb
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
require 'spec_helper.rb'
|
|
2
|
+
require 'capybara'
|
|
2
3
|
|
|
3
|
-
<%= level_one %> '<%= feature_name %>' do
|
|
4
|
-
<%= hook %>(:all) do
|
|
4
|
+
<%= local_aliases[:level_one] %> '<%= feature_name %>' do
|
|
5
|
+
<%= local_aliases[:hook] %>(:all) do
|
|
5
6
|
<%= before_all_template %>
|
|
6
|
-
binding.pry
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
<%= hook %>(:each) do
|
|
9
|
+
<%= local_aliases[:hook] %>(:each) do
|
|
10
10
|
<%= before_each_template %>
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
<%= level_two %> 'scenario one' do
|
|
13
|
+
<%= local_aliases[:level_two] %> 'scenario one' do
|
|
14
14
|
end
|
|
15
|
+
|
|
16
|
+
<%= edge_template %>
|
|
17
|
+
|
|
18
|
+
<%= simple_template %>
|
|
15
19
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%= local_aliases[:level_two] %> 'sort ascending' do
|
|
2
|
+
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
<%= local_aliases[:level_two] %> 'sort descending' do
|
|
6
|
+
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
<%= local_aliases[:level_two] %> 'filter with results' do
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
<%= local_aliases[:level_two] %> 'filter with no results' do
|
|
14
|
+
|
|
15
|
+
end
|
data/outfile.rb
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'spec_helper.rb'
|
|
2
|
+
require 'capybara'
|
|
3
|
+
|
|
4
|
+
describe 'Give your feature a name' do
|
|
5
|
+
before(:all) do
|
|
6
|
+
session = Capybara::Session.new(:selenium)
|
|
7
|
+
session.visit "http://www.amberbit.com"
|
|
8
|
+
binding.pry
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
before(:each) do
|
|
12
|
+
# before each!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'scenario one' do
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'is required' do
|
|
19
|
+
expect(nil).to be_nil
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
it 'opens something' do
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'closes something' do
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'expands something' do
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'collapses' do
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'sorts ascending' do
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'sorts descending' do
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'exists' do
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'does not exist' do
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fishbone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason McInerney
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-04-
|
|
11
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -81,8 +81,11 @@ files:
|
|
|
81
81
|
- lib/templates/before_each.erb
|
|
82
82
|
- lib/templates/edge.erb
|
|
83
83
|
- lib/templates/object.erb
|
|
84
|
+
- lib/templates/simple.erb
|
|
84
85
|
- lib/templates/specfile.erb
|
|
86
|
+
- lib/templates/table.erb
|
|
85
87
|
- noun_115499.svg
|
|
88
|
+
- outfile.rb
|
|
86
89
|
homepage: https://github.com/jasonmci/fishbone
|
|
87
90
|
licenses:
|
|
88
91
|
- MIT
|
|
@@ -109,3 +112,4 @@ signing_key:
|
|
|
109
112
|
specification_version: 4
|
|
110
113
|
summary: Generate code for test automation
|
|
111
114
|
test_files: []
|
|
115
|
+
has_rdoc:
|