system_tester 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/controllers/system_tester/stair_steps_controller.rb +42 -0
- data/app/controllers/system_tester/steps_controller.rb +11 -2
- data/app/models/system_tester/action.rb +1 -1
- data/app/models/system_tester/assertion.rb +1 -1
- data/app/models/system_tester/feature.rb +8 -0
- data/app/models/system_tester/stair.rb +56 -0
- data/app/models/system_tester/stair_step.rb +7 -0
- data/app/models/system_tester/step.rb +26 -8
- data/config/routes.rb +1 -0
- data/db/migrate/20170629120850_create_stair_steps.rb +9 -0
- data/db/schema.rb +31 -5
- data/lib/system_tester/version.rb +1 -1
- 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: 652bc548a774e0a42ba29b0f818edc42a117110b
|
4
|
+
data.tar.gz: 6206c7c9aac64360a585ee95774f2d2b500d1a10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14015439db14beb2713aa26f304b491a581eff222362dbb6aed978994f051815fdd0de5b490aa9059fc36b784bbcb925d25b24034b69c199a20b1f7c75f482fb
|
7
|
+
data.tar.gz: 8d623a4a103cd31533ebe64bb1017f0ec3adbaadb22de4eda2ec20d269740fa4e3777e02e48acb0c425531e37127bb28ae282cfec1a31f293d9aebd0568ca3e0
|
data/README.md
CHANGED
@@ -54,7 +54,8 @@ testing steps:
|
|
54
54
|
* Scenarios - 1:M assocation from Feature to Scenario. A Scenario is one test method.
|
55
55
|
* Steps - Basically a line of code that can be an action or an assertion. STI is used to provide different step types.
|
56
56
|
* ScenarioSteps - M:M assocation for Steps and Scenarios which also as a position attribute to allow for reordering.
|
57
|
-
* Stairs -
|
57
|
+
* Stairs - an ordered group of steps that can be reused.
|
58
|
+
* StairSteps - M:M association to support stairs, Stair inherits from Step so the fk points back to the same table.
|
58
59
|
|
59
60
|
## License
|
60
61
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_dependency "system_tester/application_controller"
|
2
|
+
|
3
|
+
module SystemTester
|
4
|
+
class StairStepsController < ApplicationController
|
5
|
+
|
6
|
+
def create
|
7
|
+
stair_step = StairStep.new(stair_step_params)
|
8
|
+
if stair_step.save
|
9
|
+
render json: stair_step.to_json(stair_step_json_options)
|
10
|
+
else
|
11
|
+
render json: { errors: stair_step.errors }, status: :unprocessable_entity
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def update
|
16
|
+
stair_step = StairStep.find(params[:id])
|
17
|
+
if stair_step.update(stair_step_params)
|
18
|
+
render json: stair_step.to_json(stair_step_json_options)
|
19
|
+
else
|
20
|
+
render json: { errors: stair_step.errors }, status: :unprocessable_entity
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def destroy
|
25
|
+
StairStep.find(params[:id]).destroy!
|
26
|
+
render head: :ok
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def stair_step_params
|
32
|
+
params.require(:stair_step).permit(:position, :system_tester_step_id, :system_tester_stair_id)
|
33
|
+
end
|
34
|
+
|
35
|
+
def stair_step_json_options
|
36
|
+
{
|
37
|
+
include: :step
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -45,8 +45,17 @@ module SystemTester
|
|
45
45
|
|
46
46
|
def step_json_options
|
47
47
|
{
|
48
|
-
methods: [:type, :friendly_type, :parent_type, :to_s, :bg_css, :text_css, :icon],
|
49
|
-
include:
|
48
|
+
methods: [:type, :friendly_type, :parent_type, :to_s, :bg_css, :text_css, :icon, :module],
|
49
|
+
include: {
|
50
|
+
scenarios: {},
|
51
|
+
stair_steps: {
|
52
|
+
include: {
|
53
|
+
step: {
|
54
|
+
methods: [:friendly_type, :parent_type, :bg_css, :text_css, :icon]
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
50
59
|
}
|
51
60
|
end
|
52
61
|
end
|
@@ -20,6 +20,10 @@ module SystemTester
|
|
20
20
|
str << "require 'application_system_test_case'\n\n"
|
21
21
|
str << "module SystemTester\n"
|
22
22
|
str << " class #{stripped_title.camelize}Test < ApplicationSystemTestCase\n"
|
23
|
+
stairs.each do |stair|
|
24
|
+
str << " include #{stair.module_name}\n"
|
25
|
+
end
|
26
|
+
str << "\n" unless stairs.empty?
|
23
27
|
str
|
24
28
|
end
|
25
29
|
|
@@ -30,5 +34,9 @@ module SystemTester
|
|
30
34
|
def stripped_title
|
31
35
|
title.gsub(/\s+/,"")
|
32
36
|
end
|
37
|
+
|
38
|
+
def stairs
|
39
|
+
Stair.joins(:scenarios).where("system_tester_scenarios.system_tester_feature_id = ?", id)
|
40
|
+
end
|
33
41
|
end
|
34
42
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module SystemTester
|
2
|
+
class Stair < Step
|
3
|
+
has_many :stair_steps,
|
4
|
+
-> { order 'position asc' },
|
5
|
+
class_name: "SystemTester::StairStep",
|
6
|
+
foreign_key: "system_tester_stair_id",
|
7
|
+
dependent: :destroy
|
8
|
+
has_many :steps, -> { order 'position asc' }, through: :stair_steps
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
"#{INDENT}# Stair #{title}\n#{INDENT}#{method_name}\n\n"
|
12
|
+
end
|
13
|
+
|
14
|
+
def module
|
15
|
+
str = ""
|
16
|
+
str << open
|
17
|
+
str << steps.map(&:to_s).join("")
|
18
|
+
str << close
|
19
|
+
str
|
20
|
+
end
|
21
|
+
|
22
|
+
def module_name
|
23
|
+
stripped_title.camelize
|
24
|
+
end
|
25
|
+
|
26
|
+
def icon
|
27
|
+
"clear_all"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.bg_css
|
31
|
+
"deep-purple"
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def open
|
37
|
+
str = ""
|
38
|
+
str << "module SystemTester\n"
|
39
|
+
str << " module #{module_name}\n"
|
40
|
+
str << " def #{method_name}\n"
|
41
|
+
str
|
42
|
+
end
|
43
|
+
|
44
|
+
def close
|
45
|
+
" end\n end\nend\n"
|
46
|
+
end
|
47
|
+
|
48
|
+
def stripped_title
|
49
|
+
title.gsub(/\s+/,"")
|
50
|
+
end
|
51
|
+
|
52
|
+
def method_name
|
53
|
+
stripped_title.underscore
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module SystemTester
|
2
|
+
class StairStep < ApplicationRecord
|
3
|
+
belongs_to :step, class_name: "SystemTester::Step", foreign_key: "system_tester_step_id"
|
4
|
+
belongs_to :stair, class_name: "SystemTester::Stair", foreign_type: "SystemTester::Stair", foreign_key: "system_tester_stair_id"
|
5
|
+
acts_as_list scope: :system_tester_stair_id
|
6
|
+
end
|
7
|
+
end
|
@@ -10,6 +10,12 @@ module SystemTester
|
|
10
10
|
dependent: :destroy
|
11
11
|
has_many :scenarios, through: :scenario_steps
|
12
12
|
|
13
|
+
has_many :stair_steps,
|
14
|
+
class_name: "SystemTester::StairStep",
|
15
|
+
foreign_key: "system_tester_step_id",
|
16
|
+
dependent: :destroy
|
17
|
+
has_many :stairs, through: :stair_steps
|
18
|
+
|
13
19
|
def self.friendly_type
|
14
20
|
name.demodulize
|
15
21
|
end
|
@@ -18,6 +24,14 @@ module SystemTester
|
|
18
24
|
ancestors.fourth.name.demodulize
|
19
25
|
end
|
20
26
|
|
27
|
+
def self.bg_css
|
28
|
+
"teal"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.text_css
|
32
|
+
"white-text"
|
33
|
+
end
|
34
|
+
|
21
35
|
def friendly_type
|
22
36
|
self.class.friendly_type
|
23
37
|
end
|
@@ -26,6 +40,18 @@ module SystemTester
|
|
26
40
|
self.class.parent_type
|
27
41
|
end
|
28
42
|
|
43
|
+
def bg_css
|
44
|
+
self.class.bg_css
|
45
|
+
end
|
46
|
+
|
47
|
+
def text_css
|
48
|
+
self.class.text_css
|
49
|
+
end
|
50
|
+
|
51
|
+
def module
|
52
|
+
""
|
53
|
+
end
|
54
|
+
|
29
55
|
def self.args
|
30
56
|
[
|
31
57
|
{
|
@@ -60,13 +86,5 @@ module SystemTester
|
|
60
86
|
}
|
61
87
|
end.sort_by { |step_type| step_type[:friendly] }
|
62
88
|
end
|
63
|
-
|
64
|
-
def bg_css
|
65
|
-
"teal"
|
66
|
-
end
|
67
|
-
|
68
|
-
def text_css
|
69
|
-
"white-text"
|
70
|
-
end
|
71
89
|
end
|
72
90
|
end
|
data/config/routes.rb
CHANGED
@@ -3,6 +3,7 @@ SystemTester::Engine.routes.draw do
|
|
3
3
|
resources :scenarios, only: [:index, :show, :create, :update, :destroy]
|
4
4
|
resources :steps, only: [:index, :show, :new, :create, :update, :destroy]
|
5
5
|
resources :scenario_steps, only: [:create, :update, :destroy]
|
6
|
+
resources :stair_steps, only: [:create, :update, :destroy]
|
6
7
|
resources :step_types, only: [:index] do
|
7
8
|
collection do
|
8
9
|
get :parents
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class CreateStairSteps < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :system_tester_stair_steps do |t|
|
4
|
+
t.integer :position
|
5
|
+
t.references :system_tester_step, foreign_key: true
|
6
|
+
t.references :system_tester_stair, foreign_key: { to_table: :system_tester_steps }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
data/db/schema.rb
CHANGED
@@ -10,13 +10,39 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20170629120850) do
|
14
14
|
|
15
|
-
create_table "
|
15
|
+
create_table "system_tester_features", force: :cascade do |t|
|
16
16
|
t.string "title"
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
end
|
18
|
+
|
19
|
+
create_table "system_tester_scenario_steps", force: :cascade do |t|
|
20
|
+
t.integer "position"
|
21
|
+
t.integer "system_tester_step_id"
|
22
|
+
t.integer "system_tester_scenario_id"
|
23
|
+
t.index ["system_tester_scenario_id"], name: "index_st_st_scenario_id"
|
24
|
+
t.index ["system_tester_step_id"], name: "index_system_tester_scenario_steps_on_system_tester_step_id"
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table "system_tester_scenarios", force: :cascade do |t|
|
28
|
+
t.string "title"
|
29
|
+
t.integer "system_tester_feature_id"
|
30
|
+
t.index ["system_tester_feature_id"], name: "index_system_tester_scenarios_on_system_tester_feature_id"
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "system_tester_stair_steps", force: :cascade do |t|
|
34
|
+
t.integer "position"
|
35
|
+
t.integer "system_tester_step_id"
|
36
|
+
t.integer "system_tester_stair_id"
|
37
|
+
t.index ["system_tester_stair_id"], name: "index_system_tester_stair_steps_on_system_tester_stair_id"
|
38
|
+
t.index ["system_tester_step_id"], name: "index_system_tester_stair_steps_on_system_tester_step_id"
|
39
|
+
end
|
40
|
+
|
41
|
+
create_table "system_tester_steps", force: :cascade do |t|
|
42
|
+
t.string "title"
|
43
|
+
t.string "type"
|
44
|
+
t.string "arg_one"
|
45
|
+
t.string "arg_two"
|
20
46
|
end
|
21
47
|
|
22
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: system_tester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard LaFranchi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- app/controllers/system_tester/features_controller.rb
|
68
68
|
- app/controllers/system_tester/scenario_steps_controller.rb
|
69
69
|
- app/controllers/system_tester/scenarios_controller.rb
|
70
|
+
- app/controllers/system_tester/stair_steps_controller.rb
|
70
71
|
- app/controllers/system_tester/step_types_controller.rb
|
71
72
|
- app/controllers/system_tester/steps_controller.rb
|
72
73
|
- app/jobs/system_tester/application_job.rb
|
@@ -81,6 +82,8 @@ files:
|
|
81
82
|
- app/models/system_tester/fill_in.rb
|
82
83
|
- app/models/system_tester/scenario.rb
|
83
84
|
- app/models/system_tester/scenario_step.rb
|
85
|
+
- app/models/system_tester/stair.rb
|
86
|
+
- app/models/system_tester/stair_step.rb
|
84
87
|
- app/models/system_tester/step.rb
|
85
88
|
- app/models/system_tester/visit.rb
|
86
89
|
- config/routes.rb
|
@@ -88,6 +91,7 @@ files:
|
|
88
91
|
- db/migrate/20170513213953_create_system_tester_scenarios.rb
|
89
92
|
- db/migrate/20170513214255_create_system_tester_steps.rb
|
90
93
|
- db/migrate/20170513214722_create_system_tester_scenario_steps.rb
|
94
|
+
- db/migrate/20170629120850_create_stair_steps.rb
|
91
95
|
- db/schema.rb
|
92
96
|
- lib/system_tester.rb
|
93
97
|
- lib/system_tester/engine.rb
|