symbiont 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +10 -39
- data/HISTORY.md +6 -0
- data/lib/symbiont.rb +8 -4
- data/lib/symbiont/enclosers.rb +4 -4
- data/lib/symbiont/evaluators.rb +22 -29
- data/lib/symbiont/generators.rb +82 -317
- data/lib/symbiont/platform_selenium.rb +18 -0
- data/lib/symbiont/platform_selenium/platform_object.rb +236 -0
- data/lib/symbiont/platform_selenium/web_objects/button.rb +13 -0
- data/lib/symbiont/platform_selenium/web_objects/checkbox.rb +21 -0
- data/lib/symbiont/platform_selenium/web_objects/common.rb +104 -0
- data/lib/symbiont/platform_selenium/web_objects/link.rb +13 -0
- data/lib/symbiont/platform_selenium/web_objects/radio.rb +21 -0
- data/lib/symbiont/platform_selenium/web_objects/select_list.rb +79 -0
- data/lib/symbiont/platform_selenium/web_objects/table.rb +40 -0
- data/lib/symbiont/platform_selenium/web_objects/table_row.rb +36 -0
- data/lib/symbiont/platform_selenium/web_objects/text_field.rb +14 -0
- data/lib/symbiont/platform_watir.rb +13 -4
- data/lib/symbiont/platform_watir/platform_object.rb +74 -262
- data/lib/symbiont/platform_watir/web_objects/checkbox.rb +21 -0
- data/lib/symbiont/platform_watir/web_objects/common.rb +82 -0
- data/lib/symbiont/platform_watir/web_objects/radio.rb +21 -0
- data/lib/symbiont/platform_watir/web_objects/select_list.rb +67 -0
- data/lib/symbiont/platform_watir/web_objects/table.rb +31 -0
- data/lib/symbiont/platform_watir/web_objects/table_row.rb +31 -0
- data/lib/symbiont/platform_watir/web_objects/text_field.rb +13 -0
- data/lib/symbiont/platforms.rb +18 -6
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/_common.rb +53 -74
- data/lib/symbiont/web_objects/button.rb +23 -4
- data/lib/symbiont/web_objects/checkbox.rb +24 -10
- data/lib/symbiont/web_objects/div.rb +9 -1
- data/lib/symbiont/web_objects/link.rb +25 -4
- data/lib/symbiont/web_objects/paragraph.rb +11 -0
- data/lib/symbiont/web_objects/radio.rb +27 -1
- data/lib/symbiont/web_objects/select_list.rb +20 -56
- data/lib/symbiont/web_objects/span.rb +9 -1
- data/lib/symbiont/web_objects/table.rb +19 -22
- data/lib/symbiont/web_objects/table_cell.rb +17 -1
- data/lib/symbiont/web_objects/table_row.rb +18 -25
- data/lib/symbiont/web_objects/text_field.rb +27 -11
- data/symbiont.gemspec +3 -8
- metadata +29 -122
- data/app/Gemfile +0 -4
- data/app/app.rb +0 -181
- data/app/config/database.rb +0 -9
- data/app/models/plan.rb +0 -10
- data/app/models/product.rb +0 -10
- data/app/models/study.rb +0 -11
- data/app/models/user.rb +0 -13
- data/app/public/css/style.css +0 -138
- data/app/views/create_plan.erb +0 -21
- data/app/views/create_product.erb +0 -15
- data/app/views/create_study.erb +0 -24
- data/app/views/create_user.erb +0 -60
- data/app/views/db_plans.erb +0 -31
- data/app/views/db_products.erb +0 -29
- data/app/views/db_studies.erb +0 -33
- data/app/views/db_users.erb +0 -23
- data/app/views/entity_list.erb +0 -10
- data/app/views/index.erb +0 -8
- data/app/views/layout.erb +0 -39
- data/app/views/login_page.erb +0 -17
- data/app/views/success_1.erb +0 -2
- data/app/views/success_2.erb +0 -2
- data/app/views/test_database.erb +0 -13
- data/app/views/test_events.erb +0 -51
- data/app/views/test_login.erb +0 -53
- data/app/views/test_login_error.erb +0 -22
- data/app/views/test_login_success.erb +0 -22
- data/app/views/test_page.erb +0 -184
- data/specs/button.feature +0 -44
- data/specs/checkbox.feature +0 -40
- data/specs/data_setter.feature +0 -29
- data/specs/definitions/pages.rb +0 -156
- data/specs/div.feature +0 -11
- data/specs/evaluators.feature +0 -17
- data/specs/events.feature +0 -30
- data/specs/frame.feature +0 -5
- data/specs/link.feature +0 -42
- data/specs/locators.feature +0 -17
- data/specs/radio.feature +0 -38
- data/specs/select_list.feature +0 -50
- data/specs/simple_test.feature +0 -13
- data/specs/span.feature +0 -11
- data/specs/support/env.rb +0 -20
- data/specs/support/hooks.rb +0 -11
- data/specs/support/test_steps/action_steps_buttons.rb +0 -70
- data/specs/support/test_steps/action_steps_checkboxes.rb +0 -75
- data/specs/support/test_steps/action_steps_data_setter.rb +0 -56
- data/specs/support/test_steps/action_steps_divs.rb +0 -18
- data/specs/support/test_steps/action_steps_evaluators.rb +0 -15
- data/specs/support/test_steps/action_steps_events.rb +0 -77
- data/specs/support/test_steps/action_steps_frames.rb +0 -13
- data/specs/support/test_steps/action_steps_links.rb +0 -61
- data/specs/support/test_steps/action_steps_locators.rb +0 -44
- data/specs/support/test_steps/action_steps_navigate.rb +0 -25
- data/specs/support/test_steps/action_steps_radios.rb +0 -75
- data/specs/support/test_steps/action_steps_select_lists.rb +0 -106
- data/specs/support/test_steps/action_steps_spans.rb +0 -18
- data/specs/support/test_steps/action_steps_tables.rb +0 -82
- data/specs/support/test_steps/action_steps_text_fields.rb +0 -107
- data/specs/support/test_steps/action_steps_webobjects.rb +0 -31
- data/specs/support/test_steps/simple_test_steps.rb +0 -8
- data/specs/table.feature +0 -39
- data/specs/text_field.feature +0 -47
- data/specs/web_object.feature +0 -15
@@ -2,20 +2,36 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class TextField < WebObject
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def initialize(web_object, platform)
|
6
|
+
@web_object = web_object
|
7
|
+
include_platform_specifics_for(platform)
|
8
8
|
end
|
9
|
-
|
10
|
-
# Set the value of a text field.
|
11
|
-
def value=(value)
|
12
|
-
@web_object.set value
|
13
|
-
end
|
14
|
-
|
15
|
-
# Append text to a text field.
|
9
|
+
|
16
10
|
def append(text)
|
17
|
-
|
11
|
+
web_object.send_keys text
|
18
12
|
end
|
13
|
+
|
14
|
+
def self.usable_selectors_for_watir
|
15
|
+
super + [:title, :value, :text, :label]
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.usable_selectors_for_selenium
|
19
|
+
super + [:title, :value, :text, :label]
|
20
|
+
end
|
21
|
+
|
22
|
+
def include_platform_specifics_for(platform)
|
23
|
+
super
|
24
|
+
if platform[:platform] == :watir_webdriver
|
25
|
+
require 'symbiont/platform_watir/web_objects/text_field'
|
26
|
+
self.class.send :include, Symbiont::Platforms::WatirWebDriver::TextField
|
27
|
+
elsif platform[:platform] == :selenium_webdriver
|
28
|
+
require 'symbiont/platform_selenium/web_objects/text_field'
|
29
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::TextField
|
30
|
+
else
|
31
|
+
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
19
35
|
end # class: TextField
|
20
36
|
|
21
37
|
::Symbiont::WebObjects.class_for_type[:text] = ::Symbiont::WebObjects::TextField
|
data/symbiont.gemspec
CHANGED
@@ -12,16 +12,11 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.summary = gem.description
|
13
13
|
gem.description = "An endosymbiotic facultative library for web application testing."
|
14
14
|
|
15
|
-
gem.
|
16
|
-
gem.
|
17
|
-
gem.add_development_dependency "yard", "0.8.2.1"
|
18
|
-
gem.add_development_dependency "cucumber", "1.2.1"
|
19
|
-
|
20
|
-
gem.add_runtime_dependency "watir-webdriver", "0.6.1"
|
15
|
+
gem.add_runtime_dependency "watir-webdriver", "0.6.2"
|
16
|
+
gem.add_runtime_dependency "selenium-webdriver", "2.29.0"
|
21
17
|
|
22
18
|
gem.required_ruby_version = '>= 1.9.2'
|
23
|
-
|
24
|
-
|
19
|
+
|
25
20
|
gem.files = `git ls-files`.split("\n")
|
26
21
|
gem.test_files = `git ls-files -- {test,spec,specs,features}/*`.split("\n")
|
27
22
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symbiont
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,80 +9,32 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - '='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.11.0
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - '='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.11.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: simplecov
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - '='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 0.6.4
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - '='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.6.4
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: yard
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - '='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.8.2.1
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - '='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.8.2.1
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: cucumber
|
15
|
+
name: watir-webdriver
|
64
16
|
requirement: !ruby/object:Gem::Requirement
|
65
17
|
none: false
|
66
18
|
requirements:
|
67
19
|
- - '='
|
68
20
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
70
|
-
type: :
|
21
|
+
version: 0.6.2
|
22
|
+
type: :runtime
|
71
23
|
prerelease: false
|
72
24
|
version_requirements: !ruby/object:Gem::Requirement
|
73
25
|
none: false
|
74
26
|
requirements:
|
75
27
|
- - '='
|
76
28
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
29
|
+
version: 0.6.2
|
78
30
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
31
|
+
name: selenium-webdriver
|
80
32
|
requirement: !ruby/object:Gem::Requirement
|
81
33
|
none: false
|
82
34
|
requirements:
|
83
35
|
- - '='
|
84
36
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
37
|
+
version: 2.29.0
|
86
38
|
type: :runtime
|
87
39
|
prerelease: false
|
88
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +42,7 @@ dependencies:
|
|
90
42
|
requirements:
|
91
43
|
- - '='
|
92
44
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
45
|
+
version: 2.29.0
|
94
46
|
description: An endosymbiotic facultative library for web application testing.
|
95
47
|
email:
|
96
48
|
- jeffnyman@gmail.com
|
@@ -106,34 +58,6 @@ files:
|
|
106
58
|
- LICENSE
|
107
59
|
- README.md
|
108
60
|
- Rakefile
|
109
|
-
- app/Gemfile
|
110
|
-
- app/app.rb
|
111
|
-
- app/config/database.rb
|
112
|
-
- app/models/plan.rb
|
113
|
-
- app/models/product.rb
|
114
|
-
- app/models/study.rb
|
115
|
-
- app/models/user.rb
|
116
|
-
- app/public/css/style.css
|
117
|
-
- app/views/create_plan.erb
|
118
|
-
- app/views/create_product.erb
|
119
|
-
- app/views/create_study.erb
|
120
|
-
- app/views/create_user.erb
|
121
|
-
- app/views/db_plans.erb
|
122
|
-
- app/views/db_products.erb
|
123
|
-
- app/views/db_studies.erb
|
124
|
-
- app/views/db_users.erb
|
125
|
-
- app/views/entity_list.erb
|
126
|
-
- app/views/index.erb
|
127
|
-
- app/views/layout.erb
|
128
|
-
- app/views/login_page.erb
|
129
|
-
- app/views/success_1.erb
|
130
|
-
- app/views/success_2.erb
|
131
|
-
- app/views/test_database.erb
|
132
|
-
- app/views/test_events.erb
|
133
|
-
- app/views/test_login.erb
|
134
|
-
- app/views/test_login_error.erb
|
135
|
-
- app/views/test_login_success.erb
|
136
|
-
- app/views/test_page.erb
|
137
61
|
- cucumber.yml
|
138
62
|
- lib/symbiont.rb
|
139
63
|
- lib/symbiont/data_setter.rb
|
@@ -143,8 +67,26 @@ files:
|
|
143
67
|
- lib/symbiont/generators.rb
|
144
68
|
- lib/symbiont/locators.rb
|
145
69
|
- lib/symbiont/logger.rb
|
70
|
+
- lib/symbiont/platform_selenium.rb
|
71
|
+
- lib/symbiont/platform_selenium/platform_object.rb
|
72
|
+
- lib/symbiont/platform_selenium/web_objects/button.rb
|
73
|
+
- lib/symbiont/platform_selenium/web_objects/checkbox.rb
|
74
|
+
- lib/symbiont/platform_selenium/web_objects/common.rb
|
75
|
+
- lib/symbiont/platform_selenium/web_objects/link.rb
|
76
|
+
- lib/symbiont/platform_selenium/web_objects/radio.rb
|
77
|
+
- lib/symbiont/platform_selenium/web_objects/select_list.rb
|
78
|
+
- lib/symbiont/platform_selenium/web_objects/table.rb
|
79
|
+
- lib/symbiont/platform_selenium/web_objects/table_row.rb
|
80
|
+
- lib/symbiont/platform_selenium/web_objects/text_field.rb
|
146
81
|
- lib/symbiont/platform_watir.rb
|
147
82
|
- lib/symbiont/platform_watir/platform_object.rb
|
83
|
+
- lib/symbiont/platform_watir/web_objects/checkbox.rb
|
84
|
+
- lib/symbiont/platform_watir/web_objects/common.rb
|
85
|
+
- lib/symbiont/platform_watir/web_objects/radio.rb
|
86
|
+
- lib/symbiont/platform_watir/web_objects/select_list.rb
|
87
|
+
- lib/symbiont/platform_watir/web_objects/table.rb
|
88
|
+
- lib/symbiont/platform_watir/web_objects/table_row.rb
|
89
|
+
- lib/symbiont/platform_watir/web_objects/text_field.rb
|
148
90
|
- lib/symbiont/platforms.rb
|
149
91
|
- lib/symbiont/version.rb
|
150
92
|
- lib/symbiont/web_objects.rb
|
@@ -154,6 +96,7 @@ files:
|
|
154
96
|
- lib/symbiont/web_objects/div.rb
|
155
97
|
- lib/symbiont/web_objects/link.rb
|
156
98
|
- lib/symbiont/web_objects/option.rb
|
99
|
+
- lib/symbiont/web_objects/paragraph.rb
|
157
100
|
- lib/symbiont/web_objects/radio.rb
|
158
101
|
- lib/symbiont/web_objects/select_list.rb
|
159
102
|
- lib/symbiont/web_objects/span.rb
|
@@ -193,42 +136,6 @@ files:
|
|
193
136
|
- spec/symbiont/web_objects/table_row_spec.rb
|
194
137
|
- spec/symbiont/web_objects/table_spec.rb
|
195
138
|
- spec/symbiont/web_objects/text_field_spec.rb
|
196
|
-
- specs/button.feature
|
197
|
-
- specs/checkbox.feature
|
198
|
-
- specs/data_setter.feature
|
199
|
-
- specs/definitions/pages.rb
|
200
|
-
- specs/div.feature
|
201
|
-
- specs/evaluators.feature
|
202
|
-
- specs/events.feature
|
203
|
-
- specs/frame.feature
|
204
|
-
- specs/link.feature
|
205
|
-
- specs/locators.feature
|
206
|
-
- specs/radio.feature
|
207
|
-
- specs/select_list.feature
|
208
|
-
- specs/simple_test.feature
|
209
|
-
- specs/span.feature
|
210
|
-
- specs/support/env.rb
|
211
|
-
- specs/support/hooks.rb
|
212
|
-
- specs/support/test_steps/action_steps_buttons.rb
|
213
|
-
- specs/support/test_steps/action_steps_checkboxes.rb
|
214
|
-
- specs/support/test_steps/action_steps_data_setter.rb
|
215
|
-
- specs/support/test_steps/action_steps_divs.rb
|
216
|
-
- specs/support/test_steps/action_steps_evaluators.rb
|
217
|
-
- specs/support/test_steps/action_steps_events.rb
|
218
|
-
- specs/support/test_steps/action_steps_frames.rb
|
219
|
-
- specs/support/test_steps/action_steps_links.rb
|
220
|
-
- specs/support/test_steps/action_steps_locators.rb
|
221
|
-
- specs/support/test_steps/action_steps_navigate.rb
|
222
|
-
- specs/support/test_steps/action_steps_radios.rb
|
223
|
-
- specs/support/test_steps/action_steps_select_lists.rb
|
224
|
-
- specs/support/test_steps/action_steps_spans.rb
|
225
|
-
- specs/support/test_steps/action_steps_tables.rb
|
226
|
-
- specs/support/test_steps/action_steps_text_fields.rb
|
227
|
-
- specs/support/test_steps/action_steps_webobjects.rb
|
228
|
-
- specs/support/test_steps/simple_test_steps.rb
|
229
|
-
- specs/table.feature
|
230
|
-
- specs/text_field.feature
|
231
|
-
- specs/web_object.feature
|
232
139
|
- symbiont.gemspec
|
233
140
|
homepage: https://github.com/jnyman/symbiont
|
234
141
|
licenses:
|
@@ -250,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
157
|
- !ruby/object:Gem::Version
|
251
158
|
version: '0'
|
252
159
|
requirements: []
|
253
|
-
rubyforge_project:
|
160
|
+
rubyforge_project:
|
254
161
|
rubygems_version: 1.8.24
|
255
162
|
signing_key:
|
256
163
|
specification_version: 3
|
data/app/Gemfile
DELETED
data/app/app.rb
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems' if RUBY_VERSION < '1.9'
|
3
|
-
|
4
|
-
require 'sinatra/base'
|
5
|
-
require 'sinatra/reloader'
|
6
|
-
require 'sinatra/flash'
|
7
|
-
|
8
|
-
require_relative 'config/database'
|
9
|
-
|
10
|
-
module Symbiont
|
11
|
-
class TestApp < Sinatra::Base
|
12
|
-
register Sinatra::Reloader
|
13
|
-
register Sinatra::Flash
|
14
|
-
|
15
|
-
set :sessions, true
|
16
|
-
set :app_file, __FILE__
|
17
|
-
set :public_folder, "public"
|
18
|
-
set :static, true
|
19
|
-
|
20
|
-
get '/' do
|
21
|
-
@title = "Landing Page"
|
22
|
-
erb :index
|
23
|
-
end
|
24
|
-
|
25
|
-
get '/test_page' do
|
26
|
-
@title = "Simple Object Page"
|
27
|
-
erb :test_page
|
28
|
-
end
|
29
|
-
|
30
|
-
get '/success_1' do
|
31
|
-
@title = "Success 1"
|
32
|
-
erb :success_1
|
33
|
-
end
|
34
|
-
|
35
|
-
get '/success_2' do
|
36
|
-
@title = "Success 2"
|
37
|
-
erb :success_2
|
38
|
-
end
|
39
|
-
|
40
|
-
get '/test_events' do
|
41
|
-
@title = "Simple Events Page"
|
42
|
-
erb :test_events
|
43
|
-
end
|
44
|
-
|
45
|
-
get '/test_login' do
|
46
|
-
@title = "Simple Login Demonstration"
|
47
|
-
erb :test_login
|
48
|
-
end
|
49
|
-
|
50
|
-
get '/test_login_error' do
|
51
|
-
@title = "Test Login - Error Page"
|
52
|
-
erb :test_login_error
|
53
|
-
end
|
54
|
-
|
55
|
-
post '/test_login_success' do
|
56
|
-
@title = "Test Login - Success Page"
|
57
|
-
erb :test_login_success
|
58
|
-
end
|
59
|
-
|
60
|
-
get '/test_database' do
|
61
|
-
@title = "Sample Database Application"
|
62
|
-
erb :test_database
|
63
|
-
end
|
64
|
-
|
65
|
-
get '/login_page' do
|
66
|
-
@title = "Login Page"
|
67
|
-
erb :login_page, layout: false
|
68
|
-
end
|
69
|
-
|
70
|
-
get '/entity_list' do
|
71
|
-
@title = "Entity List"
|
72
|
-
erb :entity_list
|
73
|
-
end
|
74
|
-
|
75
|
-
get '/db_products' do
|
76
|
-
@title = "Products"
|
77
|
-
@products = Product.all order: :id.desc
|
78
|
-
erb :db_products
|
79
|
-
end
|
80
|
-
|
81
|
-
get '/db_studies' do
|
82
|
-
@title = "Studies"
|
83
|
-
@studies = Study.all order: :id.desc
|
84
|
-
erb :db_studies
|
85
|
-
end
|
86
|
-
|
87
|
-
get '/db_plans' do
|
88
|
-
@title = "Plans"
|
89
|
-
@plans = Plan.all order: :id.desc
|
90
|
-
erb :db_plans
|
91
|
-
end
|
92
|
-
|
93
|
-
get '/db_users' do
|
94
|
-
@title = "Users"
|
95
|
-
@users = User.all order: :id.desc
|
96
|
-
erb :db_users
|
97
|
-
end
|
98
|
-
|
99
|
-
get '/create_product' do
|
100
|
-
@title = "Create Product"
|
101
|
-
erb :create_product
|
102
|
-
end
|
103
|
-
|
104
|
-
get '/create_study' do
|
105
|
-
@title = "Create Study"
|
106
|
-
erb :create_study
|
107
|
-
end
|
108
|
-
|
109
|
-
get '/create_plan' do
|
110
|
-
@title = "Create Plan"
|
111
|
-
erb :create_plan
|
112
|
-
end
|
113
|
-
|
114
|
-
get '/create_user' do
|
115
|
-
@title = "Create User"
|
116
|
-
erb :create_user
|
117
|
-
end
|
118
|
-
|
119
|
-
post '/create_product' do
|
120
|
-
product = Product.new
|
121
|
-
product.product_id = params[:productId]
|
122
|
-
product.name = params[:productName]
|
123
|
-
product.description = params[:productDescription]
|
124
|
-
product.created_at = Time.now
|
125
|
-
product.updated_at = Time.now
|
126
|
-
if product.save
|
127
|
-
flash[:notice] = "Product saved successfully."
|
128
|
-
else
|
129
|
-
flash[:error] = "Unable to save product."
|
130
|
-
end
|
131
|
-
redirect '/db_products'
|
132
|
-
end
|
133
|
-
|
134
|
-
post '/create_study' do
|
135
|
-
study = Study.new
|
136
|
-
study.study_name = params[:studyName]
|
137
|
-
study.protocol = params[:studyProtocol]
|
138
|
-
study.product = params[:studyProduct]
|
139
|
-
study.phase = params[:studyPhase]
|
140
|
-
if study.save
|
141
|
-
flash[:notice] = "Study saved successfully."
|
142
|
-
else
|
143
|
-
flash[:error] = "Unable to save study."
|
144
|
-
end
|
145
|
-
redirect '/db_studies'
|
146
|
-
end
|
147
|
-
|
148
|
-
post '/create_plan' do
|
149
|
-
plan = Plan.new
|
150
|
-
plan.plan_name = params[:planName]
|
151
|
-
plan.study = params[:planStudy]
|
152
|
-
plan.plan_description = params[:planDescription]
|
153
|
-
if plan.save
|
154
|
-
flash[:notice] = "Plan saved successfully."
|
155
|
-
else
|
156
|
-
flash[:error] = "Unable to save plan."
|
157
|
-
end
|
158
|
-
redirect '/db_plans'
|
159
|
-
end
|
160
|
-
|
161
|
-
post '/create_user' do
|
162
|
-
user = User.new
|
163
|
-
user.loginname = params[:loginName]
|
164
|
-
user.firstname = params[:firstName]
|
165
|
-
user.lastname = params[:lastName]
|
166
|
-
user.level = params[:level]
|
167
|
-
user.role = params[:role]
|
168
|
-
user.password = params[:password]
|
169
|
-
user.created_at = Time.now
|
170
|
-
user.updated_at = Time.now
|
171
|
-
if user.save
|
172
|
-
flash[:notice] = "User saved successfully."
|
173
|
-
else
|
174
|
-
flash[:error] = "Unable to save user."
|
175
|
-
end
|
176
|
-
redirect '/db_users'
|
177
|
-
end
|
178
|
-
end # class: TestApp
|
179
|
-
end # module: Symbiont
|
180
|
-
|
181
|
-
Symbiont::TestApp.run!
|