dtf 0.2.2 → 0.2.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.
Files changed (60) hide show
  1. data/.rspec +1 -1
  2. data/.travis.yml +7 -2
  3. data/Gemfile +3 -2
  4. data/README.md +105 -6
  5. data/Rakefile +2 -0
  6. data/app/models/analysis_case.rb +1 -1
  7. data/app/models/case_test.rb +1 -1
  8. data/app/models/user.rb +3 -2
  9. data/app/models/verification_suite.rb +1 -1
  10. data/bin/dtf +23 -20
  11. data/db/seeds.rb +4 -0
  12. data/doc/AnalysisCase.html +123 -0
  13. data/doc/CaseTest.html +123 -0
  14. data/doc/Dtf.html +129 -0
  15. data/doc/Dtf/DtfCommands.html +471 -0
  16. data/doc/User.html +123 -0
  17. data/doc/VerificationSuite.html +123 -0
  18. data/doc/_index.html +171 -0
  19. data/doc/class_list.html +53 -0
  20. data/doc/css/common.css +1 -0
  21. data/doc/css/full_list.css +57 -0
  22. data/doc/css/style.css +328 -0
  23. data/doc/file.README.html +256 -0
  24. data/doc/file_list.html +55 -0
  25. data/doc/frames.html +28 -0
  26. data/doc/index.html +256 -0
  27. data/doc/js/app.js +214 -0
  28. data/doc/js/full_list.js +173 -0
  29. data/doc/js/jquery.js +4 -0
  30. data/doc/method_list.html +100 -0
  31. data/doc/top-level-namespace.html +274 -0
  32. data/dtf.gemspec +3 -1
  33. data/lib/config/environment.rb +1 -1
  34. data/lib/dtf.rb +85 -2
  35. data/lib/dtf/dtf_error_system.rb +16 -0
  36. data/lib/dtf/dtf_help_system.rb +55 -0
  37. data/lib/dtf/version.rb +2 -2
  38. data/lib/tasks/setup.thor +5 -3
  39. data/spec/acceptance/create_basic_associations.feature +13 -0
  40. data/spec/acceptance/implement_help_system.feature +16 -0
  41. data/spec/fabricators/analysis_case_fabricator.rb +1 -1
  42. data/spec/fabricators/case_test_fabricator.rb +1 -1
  43. data/spec/fabricators/user_fabricator.rb +4 -4
  44. data/spec/fabricators/verification_suite_fabricator.rb +1 -1
  45. data/spec/models/analysis_case_spec.rb +53 -11
  46. data/spec/models/case_test_spec.rb +57 -11
  47. data/spec/models/user_spec.rb +46 -11
  48. data/spec/models/verification_suite_spec.rb +52 -12
  49. data/spec/spec_helper.rb +21 -1
  50. data/spec/steps/feature_steps.rb +14 -12
  51. data/spec/support/custom_matchers/model_steps.rb +17 -18
  52. metadata +77 -18
  53. data/bin/dtf-create_user +0 -11
  54. data/bin/dtf-create_vs +0 -10
  55. data/bin/dtf-delete_user +0 -18
  56. data/bin/dtf-delete_vs +0 -14
  57. data/bin/dtf-setup +0 -7
  58. data/spec/acceptance/0001_create_basic_models.feature +0 -9
  59. data/spec/acceptance/0002_create_basic_associations.feature +0 -11
  60. data/spec/acceptance/0003_execute_help_switch.feature +0 -7
@@ -1,21 +1,61 @@
1
- # -*- coding: UTF-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  require 'spec_helper'
4
- require 'benchmark'
5
4
 
6
- describe "Verification Suite" do
5
+ describe "VerificationSuite" do
7
6
 
8
- puts "Verification Suite Benchmark"
9
- puts Benchmark.measure { let (:verification_suite) { Fabricate(:verification_suite) } }
7
+ context "when instantiated" do
10
8
 
11
- let(:verification_suite) { Fabricate(:verification_suite) }
9
+ let(:verification_suite) { VerificationSuite.new }
10
+
11
+ it "should be the proper class" do
12
+ verification_suite.should be_a(VerificationSuite)
13
+ end
14
+
15
+ it "should be invalid without being assigned to a user" do
16
+ verification_suite.should_not be_valid
17
+ verification_suite[:user_id].should be_nil
18
+ verification_suite.new_record?.should be_true
19
+ end
20
+
21
+ it "should be invalid without a name" do
22
+ verification_suite.should_not be_valid
23
+ verification_suite.errors.messages[:name].should eq(["can't be blank"])
24
+ verification_suite.new_record?.should be_true
25
+ end
26
+
27
+ it "should be invalid without a description" do
28
+ verification_suite.should_not be_valid
29
+ verification_suite.errors.messages[:description].should eq(["can't be blank"])
30
+ verification_suite.new_record?.should be_true
31
+ end
12
32
 
13
- it "should be created/fabricated" do
14
- verification_suite.should be_a(VerificationSuite)
15
- end
33
+ it "should not be saved" do
34
+ verification_suite.new_record?.should be_true
35
+ verification_suite.persisted?.should_not be_true
36
+ end
37
+
38
+ end
39
+
40
+ context "when created" do
41
+ user = Fabricate(:user)
42
+ verification_suite = user.verification_suites.create(name: "RSpec Test VS", description: "Bogus VS for RSpec")
43
+
44
+ it "should be owned by a user" do
45
+ verification_suite.user_id.should_not be_nil
46
+ end
16
47
 
17
- it "should be persisted" do
18
- verification_suite.save
19
- verification_suite.persisted?
48
+ it "should have a valid name and description" do
49
+ verification_suite.should be_valid
50
+ verification_suite.errors.messages.should be_empty
51
+ verification_suite.name.should_not be_nil
52
+ verification_suite.description.should_not be_nil
53
+ end
54
+
55
+ it "should be saved" do
56
+ verification_suite.should be_valid
57
+ verification_suite.new_record?.should_not be_true
58
+ verification_suite.persisted?.should be_true
59
+ end
20
60
  end
21
61
  end
@@ -1,9 +1,10 @@
1
- # -*- coding: UTF-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  require 'dtf'
4
4
  require 'rspec'
5
5
  require 'turnip'
6
6
  require 'fabrication'
7
+ require 'database_cleaner'
7
8
 
8
9
  # Require any RSpec support files, helpers, and custom matchers we define
9
10
  Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each do |f|
@@ -15,4 +16,23 @@ Dir.glob("spec/steps/**/*steps.rb") do |f|
15
16
  load f, true
16
17
  end
17
18
 
19
+ # This links RSpec and Turnip for the models
18
20
  RSpec.configure { |c| c.include ModelSteps }
21
+
22
+ # This config section is for DatabaseCleaner
23
+ RSpec.configure do |config|
24
+
25
+ config.before(:suite) do
26
+ DatabaseCleaner.strategy = :transaction
27
+ DatabaseCleaner.clean_with(:truncation)
28
+ end
29
+
30
+ config.before(:each) do
31
+ DatabaseCleaner.start
32
+ end
33
+
34
+ config.after(:each) do
35
+ DatabaseCleaner.clean
36
+ end
37
+
38
+ end
@@ -1,18 +1,20 @@
1
+ # encoding: UTF-8
2
+
1
3
  step "I have dtf installed" do
2
- if Dtf::VERSION.empty?
3
- puts "Dtf gem not loaded"
4
- exit 1
4
+ if Dtf::VERSION.empty?
5
+ fail("DTF gem not loaded")
5
6
  end
6
7
  end
7
8
 
8
- # $cmd is any one of the various current dtf cmd management / control structures
9
- # TODO: Rewrite to use a single dtf control script, and modular cmd|subcmd exec|help systems
10
- step "I type :cmd" do |cmd|
11
- # Change this to check programmatically that $cmd implements --help param
12
- @cmd_text = %x[bin/#{cmd}]
9
+ step "I request help for sub-command :sub_cmd" do |cmd|
10
+ @cmds = {}
11
+ @cmds[cmd] = ''
13
12
  end
14
13
 
15
- step "I should see help system output" do
16
- # Display actual help for specific $cmd space
17
- @cmd_text.should include("help")
18
- end
14
+ step "I should see :help_response in the response" do |help_response|
15
+ @cmds.each do |cmd|
16
+ cmd[1] = "#{help_response}"
17
+ result = %x[bundle exec dtf #{cmd[0]} -h]
18
+ result.should include("#{cmd[1]}")
19
+ end
20
+ end
@@ -1,38 +1,37 @@
1
- # -*- coding: UTF-8 -*-
1
+ # encoding: UTF-8
2
2
 
3
3
  module ModelSteps
4
4
 
5
- step "a user" do
5
+ step "a User" do
6
6
  @user = Fabricate(:user)
7
+ @user.should be_a(User)
7
8
  @user.should_not be_nil
8
9
  end
9
10
 
10
- step "a verification suite" do
11
+ step "a Verification Suite" do
11
12
  @vs = Fabricate(:verification_suite)
13
+ @vs.should be_a(VerificationSuite)
12
14
  @vs.should_not be_nil
13
15
  end
14
16
 
15
- step "I should see an analysis case" do
16
- @ac = Fabricate(:analysis_case)
17
- @ac.should_not be_nil
18
- end
19
-
20
- step "I should see a case test" do
21
- @ct = Fabricate(:case_test)
22
- @ct.should_not be_nil
17
+ step "I create a/an :association" do |association|
18
+ @user.send(association.downcase.pluralize).build
23
19
  end
24
20
 
25
- step "I should see user ownership chain via :association" do |association|
26
- @user.send(association).build
27
- @user.send(association).should_not be_nil
21
+ step "I should own a/an :association" do |association|
22
+ @user.send(association.downcase.pluralize).should_not be_empty
28
23
  end
29
24
 
30
- step "I create a/an :association" do |association|
31
- @user.send(association.pluralize).build
25
+ step "I should see an Analysis Case" do
26
+ @ac = Fabricate(:analysis_case)
27
+ @ac.should be_a(AnalysisCase)
28
+ @ac.should_not be_nil
32
29
  end
33
30
 
34
- step "I should see my :association" do |association|
35
- @user.send(association.pluralize).should_not be_empty
31
+ step "I should see a Case Test" do
32
+ @ct = Fabricate(:case_test)
33
+ @ct.should be_a(CaseTest)
34
+ @ct.should_not be_nil
36
35
  end
37
36
 
38
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-20 00:00:00.000000000 Z
12
+ date: 2012-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -155,6 +155,22 @@ dependencies:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: trollop
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :runtime
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
158
174
  - !ruby/object:Gem::Dependency
159
175
  name: turnip
160
176
  requirement: !ruby/object:Gem::Requirement
@@ -219,17 +235,44 @@ dependencies:
219
235
  - - ! '>='
220
236
  - !ruby/object:Gem::Version
221
237
  version: '0'
238
+ - !ruby/object:Gem::Dependency
239
+ name: yard
240
+ requirement: !ruby/object:Gem::Requirement
241
+ none: false
242
+ requirements:
243
+ - - ! '>='
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ type: :development
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ - !ruby/object:Gem::Dependency
255
+ name: redcarpet
256
+ requirement: !ruby/object:Gem::Requirement
257
+ none: false
258
+ requirements:
259
+ - - ! '>='
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
262
+ type: :development
263
+ prerelease: false
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ none: false
266
+ requirements:
267
+ - - ! '>='
268
+ - !ruby/object:Gem::Version
269
+ version: '0'
222
270
  description: DTF is a modular testing framework skeleton. This is the control gem
223
271
  which contains the Suite's db schema(s) and control/management scripts.
224
272
  email:
225
273
  - me@deryldoucette.com
226
274
  executables:
227
275
  - dtf
228
- - dtf-create_user
229
- - dtf-create_vs
230
- - dtf-delete_user
231
- - dtf-delete_vs
232
- - dtf-setup
233
276
  extensions: []
234
277
  extra_rdoc_files: []
235
278
  files:
@@ -249,26 +292,43 @@ files:
249
292
  - app/models/user.rb
250
293
  - app/models/verification_suite.rb
251
294
  - bin/dtf
252
- - bin/dtf-create_user
253
- - bin/dtf-create_vs
254
- - bin/dtf-delete_user
255
- - bin/dtf-delete_vs
256
- - bin/dtf-setup
257
295
  - db/migrate/20120503050925_create_users.rb
258
296
  - db/migrate/20120508000959_create_verification_suites.rb
259
297
  - db/migrate/20120616203047_create_analysis_cases.rb
260
298
  - db/migrate/20120616203436_create_case_tests.rb
261
299
  - db/schema.rb
300
+ - db/seeds.rb
262
301
  - doc/.gitkeep
302
+ - doc/AnalysisCase.html
303
+ - doc/CaseTest.html
304
+ - doc/Dtf.html
305
+ - doc/Dtf/DtfCommands.html
306
+ - doc/User.html
307
+ - doc/VerificationSuite.html
308
+ - doc/_index.html
309
+ - doc/class_list.html
310
+ - doc/css/common.css
311
+ - doc/css/full_list.css
312
+ - doc/css/style.css
313
+ - doc/file.README.html
314
+ - doc/file_list.html
315
+ - doc/frames.html
316
+ - doc/index.html
317
+ - doc/js/app.js
318
+ - doc/js/full_list.js
319
+ - doc/js/jquery.js
320
+ - doc/method_list.html
321
+ - doc/top-level-namespace.html
263
322
  - dtf.gemspec
264
323
  - examples/db/config.yml
265
324
  - lib/config/environment.rb
266
325
  - lib/dtf.rb
326
+ - lib/dtf/dtf_error_system.rb
327
+ - lib/dtf/dtf_help_system.rb
267
328
  - lib/dtf/version.rb
268
329
  - lib/tasks/setup.thor
269
- - spec/acceptance/0001_create_basic_models.feature
270
- - spec/acceptance/0002_create_basic_associations.feature
271
- - spec/acceptance/0003_execute_help_switch.feature
330
+ - spec/acceptance/create_basic_associations.feature
331
+ - spec/acceptance/implement_help_system.feature
272
332
  - spec/fabricators/analysis_case_fabricator.rb
273
333
  - spec/fabricators/case_test_fabricator.rb
274
334
  - spec/fabricators/user_fabricator.rb
@@ -307,9 +367,8 @@ signing_key:
307
367
  specification_version: 3
308
368
  summary: DTF is a modular testing framework. This is the control gem.
309
369
  test_files:
310
- - spec/acceptance/0001_create_basic_models.feature
311
- - spec/acceptance/0002_create_basic_associations.feature
312
- - spec/acceptance/0003_execute_help_switch.feature
370
+ - spec/acceptance/create_basic_associations.feature
371
+ - spec/acceptance/implement_help_system.feature
313
372
  - spec/fabricators/analysis_case_fabricator.rb
314
373
  - spec/fabricators/case_test_fabricator.rb
315
374
  - spec/fabricators/user_fabricator.rb
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This script is used to create User entries in the db for owning the various
4
- # Verification Suites, Analysis Cases, and Case Tests
5
- #
6
- # Ex: dtf-create_user -u|--user @user_name -n|--name "John Public" -e|--email
7
- # "j@public.com"
8
- #
9
- # -u -n and -e are _required_ parameters
10
- #
11
-
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file is used to create a Verification Suite from the commandline.
4
- # A owning User, which must already exist, must be passed for ownership.
5
- # At minimum, the name of the suite must also be passed.
6
- #
7
- # Ex: dtf-create_vs -u|--user @user_name -n|--name "DTF Testing Suite"
8
- # -u and -n are _required_ parameters
9
- #
10
-
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This script is used to delete existing User entries in the db
4
- # This script will also need to reassign any existing entries such as for their
5
- # Verification Suites, Analysis Cases, and Case Tests to the Public user
6
- # The Public user is a generic user that needs to be created initially so that
7
- # when a user is deleted, their suites are assigned to Public if they wish to
8
- # be kept. The deletion should ask if the suites should be permanently deleted
9
- # or reassigned to Public.
10
- #
11
- # Ex: dtf-delete_user -u|--user @user_name [--all] [--reassign]
12
- # --all means to delete all the user test suites permenantly
13
- # --reassign means reassign test suites to the Public user for reuse by others
14
- # first, and then delete the specified user.
15
- #
16
- # -u and EITHER --all OR --reassign are _required_ parameters
17
- #
18
-
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This script is used to delete existing Verification Suite entries in the db
4
- # The Public user is a generic user that needs to be created initially so that
5
- # when a user is deleted, their suites are assigned to Public if they wish to
6
- # be kept. The deletion should ask if the suites should be permanently deleted
7
- # or reassigned to Public. This applies to all Analysis Cases, and Case Tests
8
- # as well
9
- #
10
- # Ex dtf-delete_vs -u|--user @user_name -n|--name "DTF Testing Suite"
11
- #
12
- # -u and -n are _required_ parameters
13
- #
14
-
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'dtf'
4
- require 'thor'
5
-
6
- %x[thor dtf_setup:install]
7
-
@@ -1,9 +0,0 @@
1
- Feature: Basic Model(s) Creation
2
- Background:
3
- Given a user
4
- And a verification suite
5
-
6
- Scenario: Fundamental Models instantiate
7
- Then I should see user ownership chain via verification suites
8
- And I should see an analysis case
9
- And I should see a case test
@@ -1,11 +0,0 @@
1
- Feature: Verification of associations
2
- Background:
3
- Given a user
4
-
5
- Scenario: it should own verification suites
6
- When I create a verification suite
7
- Then I should see my verification suite
8
-
9
- Scenario: it should own analysis cases
10
- When I create a analysis case
11
- Then I should see my analysis case
@@ -1,7 +0,0 @@
1
- Feature: Display DTF help system to users upon request
2
- Background:
3
- Given I have dtf installed
4
-
5
- Scenario: User should be able to request DTF command-specific help overview
6
- When I type "dtf --help"
7
- Then I should see help system output