priority_test 0.0.1 → 0.0.2

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 (48) hide show
  1. data/.gitignore +1 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +0 -1
  4. data/README.md +64 -1
  5. data/Rakefile +9 -12
  6. data/bin/pt +25 -0
  7. data/lib/priority_test/autorun.rb +2 -0
  8. data/lib/priority_test/core/all_tests.rb +30 -0
  9. data/lib/priority_test/core/configuration.rb +23 -0
  10. data/lib/priority_test/core/configuration_options.rb +19 -0
  11. data/lib/priority_test/core/option_parser.rb +84 -0
  12. data/lib/priority_test/core/priority.rb +62 -0
  13. data/lib/priority_test/core/priority_sort_element.rb +23 -0
  14. data/lib/priority_test/core/runner.rb +26 -0
  15. data/lib/priority_test/core/service.rb +14 -0
  16. data/lib/priority_test/core/test.rb +53 -0
  17. data/lib/priority_test/core/test_result.rb +25 -0
  18. data/lib/priority_test/core/test_result_collector.rb +40 -0
  19. data/lib/priority_test/core/validations_helper.rb +17 -0
  20. data/lib/priority_test/core.rb +41 -0
  21. data/lib/priority_test/gateway/migrations/001_create_tests.rb +11 -0
  22. data/lib/priority_test/gateway/migrations/002_create_test_results.rb +12 -0
  23. data/lib/priority_test/gateway/sequel.rb +33 -0
  24. data/lib/priority_test/gateway.rb +13 -0
  25. data/lib/priority_test/rspec.rb +19 -0
  26. data/lib/priority_test/rspec2/example_group_sorter.rb +24 -0
  27. data/lib/priority_test/rspec2/example_sorter.rb +12 -0
  28. data/lib/priority_test/rspec2/formatter.rb +35 -0
  29. data/lib/priority_test/rspec2/patch/example_group.rb +18 -0
  30. data/lib/priority_test/rspec2/patch/world.rb +7 -0
  31. data/lib/priority_test/rspec2/relative_path.rb +13 -0
  32. data/lib/priority_test/rspec2.rb +20 -0
  33. data/lib/priority_test/version.rb +1 -1
  34. data/lib/priority_test.rb +25 -2
  35. data/priority_test.gemspec +4 -5
  36. data/spec/core/all_tests_spec.rb +53 -0
  37. data/spec/core/config_spec.rb +53 -0
  38. data/spec/core/configuration_options_spec.rb +16 -0
  39. data/spec/core/option_parser_spec.rb +42 -0
  40. data/spec/core/priority_spec.rb +9 -0
  41. data/spec/core/service_spec.rb +55 -0
  42. data/spec/core/test_result_spec.rb +29 -0
  43. data/spec/core/test_spec.rb +121 -0
  44. data/spec/gateways/sequel_spec.rb +43 -0
  45. data/spec/rspec2/formatter_spec.rb +67 -0
  46. data/spec/spec_helper.rb +18 -0
  47. data/spec/support/rspec_factory.rb +17 -0
  48. metadata +80 -5
@@ -0,0 +1,67 @@
1
+ require 'spec_helper'
2
+
3
+ describe PriorityTest::RSpec2::Formatter do
4
+ it "adds to test result" do
5
+ passed_examples = [
6
+ double('passed example',
7
+ :full_description => "desc1",
8
+ :file_path => "file_path",
9
+ :description => "passed example",
10
+ :execution_result => { :status => 'passed', :started_at => Time.now, :run_time => 1}
11
+ )
12
+ ]
13
+
14
+ failed_examples = [
15
+ double('failed spec 1',
16
+ :full_description => "desc2",
17
+ :file_path => "file_path",
18
+ :description => "first failed example",
19
+ :execution_result => { :status => 'failed', :started_at => Time.now, :run_time => 1, :exception => Exception.new }
20
+ ),
21
+ double('failed spec 2',
22
+ :full_description => "desc3",
23
+ :file_path => "file_path",
24
+ :description => "second failed example",
25
+ :execution_result => { :status => 'failed', :started_at => Time.now, :run_time => 1, :exception => Exception.new }
26
+ )
27
+ ]
28
+
29
+ test_result_collector = PriorityTest::Core::TestResultCollector.new(PriorityTest::Core::AllTests.new)
30
+ formatter = PriorityTest::RSpec2::Formatter.new(test_result_collector)
31
+
32
+ passed_examples.each {|e| formatter.example_passed(e) }
33
+ failed_examples.each {|e| formatter.example_failed(e) }
34
+
35
+ test_result_collector.all_tests.size.should == 3
36
+ end
37
+
38
+ # it "capures passed test result" do
39
+ # test_result_collector = PriorityTest::Core::TestResultCollector.new
40
+ # formatter = PriorityTest::RSpec2::Formatter.new(test_result_collector)
41
+ # RSpecFactory.passing_spec.run(RSpec::Core::Reporter.new(formatter))
42
+
43
+ # test_result_collector.passed_tests.size.should == 1
44
+
45
+ # passed_test = test_result_collector.passed_tests.first
46
+ # passed_test.identifier.should be
47
+ # passed_test.file_path.should be
48
+ # passed_test.status.should == 'passed'
49
+ # passed_test.run_time.should be
50
+ # passed_test.started_at.should be
51
+ # end
52
+
53
+ # it "capures failed test result" do
54
+ # test_result_collector = PriorityTest::Core::TestResultCollector.new
55
+ # formatter = PriorityTest::RSpec2::Formatter.new(test_result_collector)
56
+ # RSpecFactory.failing_spec.run(RSpec::Core::Reporter.new(formatter))
57
+
58
+ # test_result_collector.failed_tests.size.should == 1
59
+
60
+ # failed_test = test_result_collector.failed_tests.first
61
+ # failed_test.identifier.should be
62
+ # failed_test.file_path.should be
63
+ # failed_test.status.should == 'failed'
64
+ # failed_test.run_time.should be
65
+ # failed_test.started_at.should be
66
+ # end
67
+ end
@@ -0,0 +1,18 @@
1
+ ENV['PRIORITY_TEST_ENV'] = 'test'
2
+
3
+ unless defined? PriorityTest
4
+ $:.unshift File.expand_path('../../lib', __FILE__)
5
+ require 'priority_test'
6
+ require_path 'rspec2'
7
+ end
8
+
9
+ Dir[File.expand_path("support/**/*.rb", File.dirname(__FILE__))].each {|f| require f}
10
+
11
+ require 'logger'
12
+ PriorityTest::Gateway::Sequel.database.logger = Logger.new(STDOUT)
13
+
14
+ RSpec.configure do |config|
15
+ config.around :each do |example|
16
+ PriorityTest::Gateway::Sequel.database.transaction(:rollback => :always){example.call}
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ class RSpecFactory
2
+ def self.passing_spec
3
+ RSpec::Core::ExampleGroup.describe("passing spec") do
4
+ it "passes" do
5
+ 1.should eq(1)
6
+ end
7
+ end
8
+ end
9
+
10
+ def self.failing_spec
11
+ RSpec::Core::ExampleGroup.describe("failing spec") do
12
+ it "fails" do
13
+ 1.should eq(2)
14
+ end
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: priority_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,23 +9,86 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-23 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2012-01-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sequel
16
+ requirement: &70273207657860 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70273207657860
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70273207657360 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70273207657360
14
36
  description: Run tests in priority
15
37
  email:
16
38
  - jingweno@gmail.com
17
- executables: []
39
+ executables:
40
+ - pt
18
41
  extensions: []
19
42
  extra_rdoc_files: []
20
43
  files:
21
44
  - .gitignore
45
+ - .rspec
22
46
  - .rvmrc
23
47
  - Gemfile
24
48
  - README.md
25
49
  - Rakefile
50
+ - bin/pt
26
51
  - lib/priority_test.rb
52
+ - lib/priority_test/autorun.rb
53
+ - lib/priority_test/core.rb
54
+ - lib/priority_test/core/all_tests.rb
55
+ - lib/priority_test/core/configuration.rb
56
+ - lib/priority_test/core/configuration_options.rb
57
+ - lib/priority_test/core/option_parser.rb
58
+ - lib/priority_test/core/priority.rb
59
+ - lib/priority_test/core/priority_sort_element.rb
60
+ - lib/priority_test/core/runner.rb
61
+ - lib/priority_test/core/service.rb
62
+ - lib/priority_test/core/test.rb
63
+ - lib/priority_test/core/test_result.rb
64
+ - lib/priority_test/core/test_result_collector.rb
65
+ - lib/priority_test/core/validations_helper.rb
66
+ - lib/priority_test/gateway.rb
67
+ - lib/priority_test/gateway/migrations/001_create_tests.rb
68
+ - lib/priority_test/gateway/migrations/002_create_test_results.rb
69
+ - lib/priority_test/gateway/sequel.rb
70
+ - lib/priority_test/rspec.rb
71
+ - lib/priority_test/rspec2.rb
72
+ - lib/priority_test/rspec2/example_group_sorter.rb
73
+ - lib/priority_test/rspec2/example_sorter.rb
74
+ - lib/priority_test/rspec2/formatter.rb
75
+ - lib/priority_test/rspec2/patch/example_group.rb
76
+ - lib/priority_test/rspec2/patch/world.rb
77
+ - lib/priority_test/rspec2/relative_path.rb
27
78
  - lib/priority_test/version.rb
28
79
  - priority_test.gemspec
80
+ - spec/core/all_tests_spec.rb
81
+ - spec/core/config_spec.rb
82
+ - spec/core/configuration_options_spec.rb
83
+ - spec/core/option_parser_spec.rb
84
+ - spec/core/priority_spec.rb
85
+ - spec/core/service_spec.rb
86
+ - spec/core/test_result_spec.rb
87
+ - spec/core/test_spec.rb
88
+ - spec/gateways/sequel_spec.rb
89
+ - spec/rspec2/formatter_spec.rb
90
+ - spec/spec_helper.rb
91
+ - spec/support/rspec_factory.rb
29
92
  homepage: ''
30
93
  licenses: []
31
94
  post_install_message:
@@ -50,4 +113,16 @@ rubygems_version: 1.8.10
50
113
  signing_key:
51
114
  specification_version: 3
52
115
  summary: Run tests in priority
53
- test_files: []
116
+ test_files:
117
+ - spec/core/all_tests_spec.rb
118
+ - spec/core/config_spec.rb
119
+ - spec/core/configuration_options_spec.rb
120
+ - spec/core/option_parser_spec.rb
121
+ - spec/core/priority_spec.rb
122
+ - spec/core/service_spec.rb
123
+ - spec/core/test_result_spec.rb
124
+ - spec/core/test_spec.rb
125
+ - spec/gateways/sequel_spec.rb
126
+ - spec/rspec2/formatter_spec.rb
127
+ - spec/spec_helper.rb
128
+ - spec/support/rspec_factory.rb