simplecov 0.6.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +163 -80
  3. data/LICENSE +1 -1
  4. data/README.md +776 -277
  5. data/doc/alternate-formatters.md +71 -0
  6. data/doc/commercial-services.md +25 -0
  7. data/doc/editor-integration.md +18 -0
  8. data/lib/minitest/simplecov_plugin.rb +15 -0
  9. data/lib/simplecov/combine/branches_combiner.rb +32 -0
  10. data/lib/simplecov/combine/files_combiner.rb +24 -0
  11. data/lib/simplecov/combine/lines_combiner.rb +43 -0
  12. data/lib/simplecov/combine/results_combiner.rb +60 -0
  13. data/lib/simplecov/combine.rb +30 -0
  14. data/lib/simplecov/command_guesser.rb +53 -38
  15. data/lib/simplecov/configuration.rb +478 -193
  16. data/lib/simplecov/coverage_statistics.rb +56 -0
  17. data/lib/simplecov/default_formatter.rb +20 -0
  18. data/lib/simplecov/defaults.rb +40 -44
  19. data/lib/simplecov/exit_codes/exit_code_handling.rb +29 -0
  20. data/lib/simplecov/exit_codes/maximum_coverage_drop_check.rb +83 -0
  21. data/lib/simplecov/exit_codes/minimum_coverage_by_file_check.rb +54 -0
  22. data/lib/simplecov/exit_codes/minimum_overall_coverage_check.rb +53 -0
  23. data/lib/simplecov/exit_codes.rb +15 -0
  24. data/lib/simplecov/file_list.rb +112 -36
  25. data/lib/simplecov/filter.rb +54 -4
  26. data/lib/simplecov/formatter/multi_formatter.rb +32 -0
  27. data/lib/simplecov/formatter/simple_formatter.rb +21 -15
  28. data/lib/simplecov/formatter.rb +4 -1
  29. data/lib/simplecov/last_run.rb +28 -0
  30. data/lib/simplecov/lines_classifier.rb +48 -0
  31. data/lib/simplecov/load_global_config.rb +8 -0
  32. data/lib/simplecov/no_defaults.rb +4 -0
  33. data/lib/simplecov/process.rb +19 -0
  34. data/lib/simplecov/profiles/bundler_filter.rb +5 -0
  35. data/lib/simplecov/profiles/hidden_filter.rb +5 -0
  36. data/lib/simplecov/profiles/rails.rb +18 -0
  37. data/lib/simplecov/profiles/root_filter.rb +10 -0
  38. data/lib/simplecov/profiles/test_frameworks.rb +8 -0
  39. data/lib/simplecov/profiles.rb +35 -0
  40. data/lib/simplecov/result.rb +33 -64
  41. data/lib/simplecov/result_adapter.rb +30 -0
  42. data/lib/simplecov/result_merger.rb +178 -64
  43. data/lib/simplecov/simulate_coverage.rb +29 -0
  44. data/lib/simplecov/source_file/branch.rb +84 -0
  45. data/lib/simplecov/source_file/line.rb +72 -0
  46. data/lib/simplecov/source_file.rb +304 -123
  47. data/lib/simplecov/useless_results_remover.rb +18 -0
  48. data/lib/simplecov/version.rb +4 -2
  49. data/lib/simplecov.rb +396 -49
  50. metadata +81 -242
  51. data/.gitignore +0 -30
  52. data/.rvmrc +0 -1
  53. data/.travis.yml +0 -13
  54. data/Gemfile +0 -9
  55. data/Rakefile +0 -16
  56. data/cucumber.yml +0 -13
  57. data/features/config_adapters.feature +0 -44
  58. data/features/config_autoload.feature +0 -46
  59. data/features/config_command_name.feature +0 -33
  60. data/features/config_coverage_dir.feature +0 -20
  61. data/features/config_deactivate_merging.feature +0 -42
  62. data/features/config_merge_timeout.feature +0 -38
  63. data/features/config_nocov_token.feature +0 -79
  64. data/features/config_project_name.feature +0 -27
  65. data/features/config_styles.feature +0 -93
  66. data/features/cucumber_basic.feature +0 -29
  67. data/features/merging_test_unit_and_rspec.feature +0 -44
  68. data/features/rspec_basic.feature +0 -31
  69. data/features/rspec_fails_on_initialization.feature +0 -14
  70. data/features/rspec_groups_and_filters_basic.feature +0 -29
  71. data/features/rspec_groups_and_filters_complex.feature +0 -35
  72. data/features/rspec_groups_using_filter_class.feature +0 -40
  73. data/features/rspec_without_simplecov.feature +0 -20
  74. data/features/skipping_code_blocks_manually.feature +0 -70
  75. data/features/step_definitions/html_steps.rb +0 -45
  76. data/features/step_definitions/simplecov_steps.rb +0 -61
  77. data/features/step_definitions/transformers.rb +0 -13
  78. data/features/step_definitions/web_steps.rb +0 -64
  79. data/features/support/env.rb +0 -26
  80. data/features/test_unit_basic.feature +0 -34
  81. data/features/test_unit_groups_and_filters_basic.feature +0 -29
  82. data/features/test_unit_groups_and_filters_complex.feature +0 -35
  83. data/features/test_unit_groups_using_filter_class.feature +0 -40
  84. data/features/test_unit_without_simplecov.feature +0 -20
  85. data/features/unicode_compatiblity.feature +0 -67
  86. data/lib/simplecov/adapters.rb +0 -29
  87. data/lib/simplecov/merge_helpers.rb +0 -39
  88. data/lib/simplecov/railtie.rb +0 -7
  89. data/lib/simplecov/railties/tasks.rake +0 -11
  90. data/simplecov.gemspec +0 -28
  91. data/test/faked_project/Gemfile +0 -6
  92. data/test/faked_project/Rakefile +0 -8
  93. data/test/faked_project/cucumber.yml +0 -13
  94. data/test/faked_project/features/step_definitions/my_steps.rb +0 -23
  95. data/test/faked_project/features/support/env.rb +0 -12
  96. data/test/faked_project/features/test_stuff.feature +0 -6
  97. data/test/faked_project/lib/faked_project/framework_specific.rb +0 -18
  98. data/test/faked_project/lib/faked_project/meta_magic.rb +0 -24
  99. data/test/faked_project/lib/faked_project/some_class.rb +0 -29
  100. data/test/faked_project/lib/faked_project.rb +0 -11
  101. data/test/faked_project/spec/faked_spec.rb +0 -11
  102. data/test/faked_project/spec/meta_magic_spec.rb +0 -10
  103. data/test/faked_project/spec/some_class_spec.rb +0 -10
  104. data/test/faked_project/spec/spec_helper.rb +0 -15
  105. data/test/faked_project/test/faked_test.rb +0 -11
  106. data/test/faked_project/test/meta_magic_test.rb +0 -13
  107. data/test/faked_project/test/some_class_test.rb +0 -15
  108. data/test/faked_project/test/test_helper.rb +0 -16
  109. data/test/fixtures/app/controllers/sample_controller.rb +0 -10
  110. data/test/fixtures/app/models/user.rb +0 -10
  111. data/test/fixtures/deleted_source_sample.rb +0 -15
  112. data/test/fixtures/frameworks/rspec_bad.rb +0 -9
  113. data/test/fixtures/frameworks/rspec_good.rb +0 -9
  114. data/test/fixtures/frameworks/testunit_bad.rb +0 -9
  115. data/test/fixtures/frameworks/testunit_good.rb +0 -9
  116. data/test/fixtures/resultset1.rb +0 -4
  117. data/test/fixtures/resultset2.rb +0 -5
  118. data/test/fixtures/sample.rb +0 -16
  119. data/test/fixtures/utf-8.rb +0 -3
  120. data/test/helper.rb +0 -35
  121. data/test/shoulda_macros.rb +0 -29
  122. data/test/test_1_8_fallbacks.rb +0 -33
  123. data/test/test_command_guesser.rb +0 -21
  124. data/test/test_deleted_source.rb +0 -16
  125. data/test/test_file_list.rb +0 -24
  126. data/test/test_filters.rb +0 -80
  127. data/test/test_merge_helpers.rb +0 -107
  128. data/test/test_result.rb +0 -147
  129. data/test/test_return_codes.rb +0 -39
  130. data/test/test_source_file.rb +0 -86
  131. data/test/test_source_file_line.rb +0 -110
@@ -1,64 +0,0 @@
1
- module WithinHelpers
2
- def with_scope(locator)
3
- locator ? within(locator) { yield } : yield
4
- end
5
- end
6
- World(WithinHelpers)
7
-
8
- When /^I open the coverage report$/ do
9
- visit '/'
10
- end
11
-
12
- Given /^(?:|I )am on (.+)$/ do |path|
13
- visit path
14
- end
15
-
16
- When /^(?:|I )go to (.+)$/ do |path|
17
- visit path
18
- end
19
-
20
- When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
21
- with_scope(selector) do
22
- click_button(button)
23
- end
24
- end
25
-
26
- When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
27
- with_scope(selector) do
28
- click_link(link)
29
- end
30
- end
31
-
32
- Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
33
- with_scope(selector) do
34
- page.should have_content(text)
35
- end
36
- end
37
-
38
- Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
39
- regexp = Regexp.new(regexp)
40
- with_scope(selector) do
41
- page.should have_xpath('//*', :text => regexp)
42
- end
43
- end
44
-
45
- Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
46
- with_scope(selector) do
47
- page.should have_no_content(text)
48
- end
49
- end
50
-
51
- Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
52
- regexp = Regexp.new(regexp)
53
- with_scope(selector) do
54
- page.should have_no_xpath('//*', :text => regexp)
55
- end
56
- end
57
-
58
- Then /^show me the page$/ do
59
- save_and_open_page
60
- end
61
-
62
- Then /^print the page$/ do
63
- puts page.body
64
- end
@@ -1,26 +0,0 @@
1
- unless RUBY_VERSION =~ /1\.9/
2
- $stderr.puts "Sorry, Cucumber features are only meant to run on Ruby 1.9 for now :("
3
- exit 0
4
- end
5
-
6
- require 'bundler'
7
- Bundler.setup
8
- require 'aruba/cucumber'
9
- require 'capybara/cucumber'
10
-
11
- # Fake rack app for capybara that just returns the latest coverage report from aruba temp project dir
12
- Capybara.app = lambda {|env|
13
- [200, {'Content-Type' => 'text/html'},
14
- [File.read(File.join(File.dirname(__FILE__), '../../tmp/aruba/project', 'coverage/index.html'))]]
15
- }
16
-
17
- Before do
18
- @aruba_timeout_seconds = 20
19
- this_dir = File.dirname(__FILE__)
20
- # Clean up and create blank state for fake project
21
- in_current_dir do
22
- FileUtils.rm_rf 'project'
23
- FileUtils.cp_r File.join(this_dir, '../../test/faked_project/'), 'project'
24
- end
25
- step 'I cd to "project"'
26
- end
@@ -1,34 +0,0 @@
1
- @test_unit
2
- Feature:
3
-
4
- Simply adding the basic simplecov lines to a project should get
5
- the user a coverage report after running `rake test`
6
-
7
- Scenario:
8
- Given SimpleCov for Test/Unit is configured with:
9
- """
10
- require 'simplecov'
11
- SimpleCov.start
12
- """
13
-
14
- When I open the coverage report generated with `bundle exec rake test`
15
- Then I should see the groups:
16
- | name | coverage | files |
17
- | All Files | 91.38% | 6 |
18
-
19
- And I should see the source files:
20
- | name | coverage |
21
- | lib/faked_project.rb | 100.0 % |
22
- | lib/faked_project/some_class.rb | 80.0 % |
23
- | lib/faked_project/framework_specific.rb | 75.0 % |
24
- | lib/faked_project/meta_magic.rb | 100.0 % |
25
- | test/meta_magic_test.rb | 100.0 % |
26
- | test/some_class_test.rb | 100.0 % |
27
-
28
- # Note: faked_test.rb is not appearing here since that's the first unit test file
29
- # loaded by Rake, and only there test_helper is required, which then loads simplecov
30
- # and triggers tracking of all other loaded files! Solution for this would be to
31
- # configure simplecov in this first test instead of test_helper.
32
-
33
- And the report should be based upon:
34
- | Unit Tests |
@@ -1,29 +0,0 @@
1
- @test_unit
2
- Feature:
3
-
4
- Defining some groups and filters should give a corresponding
5
- coverage report that respects those settings after running tests
6
-
7
- Scenario:
8
- Given SimpleCov for Test/Unit is configured with:
9
- """
10
- require 'simplecov'
11
- SimpleCov.start do
12
- add_group 'Libs', 'lib/faked_project/'
13
- add_filter '/test/'
14
- end
15
- """
16
-
17
- When I open the coverage report generated with `bundle exec rake test`
18
- Then I should see the groups:
19
- | name | coverage | files |
20
- | All Files | 88.1% | 4 |
21
- | Libs | 86.11% | 3 |
22
- | Ungrouped | 100.0% | 1 |
23
-
24
- And I should see the source files:
25
- | name | coverage |
26
- | lib/faked_project.rb | 100.0 % |
27
- | lib/faked_project/some_class.rb | 80.0 % |
28
- | lib/faked_project/framework_specific.rb | 75.0 % |
29
- | lib/faked_project/meta_magic.rb | 100.0 % |
@@ -1,35 +0,0 @@
1
- @test_unit
2
- Feature: Sophisticated grouping and filtering on Test/Unit
3
-
4
- Defining groups and filters can be done by passing blocks or strings.
5
- Blocks get each SimpleCov::SourceFile instance passed an can use arbitrary
6
- and potentially weird conditions to remove files from the report or add them
7
- to specific groups.
8
-
9
- Scenario:
10
- Given SimpleCov for Test/Unit is configured with:
11
- """
12
- require 'simplecov'
13
- SimpleCov.start do
14
- add_group 'By block' do |src_file|
15
- src_file.filename =~ /MaGiC/i
16
- end
17
- add_group 'By string', 'project/meta_magic'
18
-
19
- add_filter 'faked_project.rb'
20
- # Remove all files that include "describe" in their source
21
- add_filter {|src_file| src_file.lines.any? {|line| line.src =~ /TestCase/ } }
22
- add_filter {|src_file| src_file.covered_percent < 100 }
23
- end
24
- """
25
-
26
- When I open the coverage report generated with `bundle exec rake test`
27
- Then I should see the groups:
28
- | name | coverage | files |
29
- | All Files | 100.0% | 1 |
30
- | By block | 100.0% | 1 |
31
- | By string | 100.0% | 1 |
32
-
33
- And I should see the source files:
34
- | name | coverage |
35
- | lib/faked_project/meta_magic.rb | 100.0 % |
@@ -1,40 +0,0 @@
1
- @test_unit
2
- Feature: Grouping on Test/Unit using a custom filter class
3
-
4
- Next to passing a block or a string to define a group, you can also pass
5
- a filter class. The filter class inherits from SimpleCov::Filter and
6
- must implement the matches? method, which is used to determine whether
7
- or not a file should be added to the group.
8
-
9
- Scenario:
10
- Given SimpleCov for Test/Unit is configured with:
11
- """
12
- require 'simplecov'
13
- class CoverageFilter < SimpleCov::Filter
14
- def matches?(source_file)
15
- source_file.covered_percent < filter_argument
16
- end
17
- end
18
- SimpleCov.start do
19
- add_group 'By filter class', CoverageFilter.new(90)
20
- add_group 'By string', 'project/meta_magic'
21
- end
22
- """
23
-
24
- When I open the coverage report generated with `bundle exec rake test`
25
- Then I should see the groups:
26
- | name | coverage | files |
27
- | All Files | 91.38% | 6 |
28
- | By filter class | 78.26% | 2 |
29
- | By string | 100.0% | 1 |
30
- | Ungrouped | 100.0% | 3 |
31
-
32
- And I should see the source files:
33
- | name | coverage |
34
- | lib/faked_project/framework_specific.rb | 75.0 % |
35
- | lib/faked_project/some_class.rb | 80.0 % |
36
- | lib/faked_project.rb | 100.0 % |
37
- | lib/faked_project/meta_magic.rb | 100.0 % |
38
- | test/meta_magic_test.rb | 100.0 % |
39
- | test/some_class_test.rb | 100.0 % |
40
-
@@ -1,20 +0,0 @@
1
- @test_unit
2
- Feature:
3
-
4
- Running unit tests without simplecov configuration
5
-
6
- Scenario: No config at all
7
- When I successfully run `bundle exec rake test`
8
- Then no coverage report should have been generated
9
-
10
- Scenario: Configured, but not started
11
- Given SimpleCov for Test/Unit is configured with:
12
- """
13
- require 'simplecov'
14
- SimpleCov.configure do
15
- add_filter 'somefilter'
16
- end
17
- """
18
-
19
- When I successfully run `bundle exec rake test`
20
- Then no coverage report should have been generated
@@ -1,67 +0,0 @@
1
- @test_unit @unicode
2
- Feature:
3
-
4
- Files with unicode in their source should be no problem at all for
5
- generating a proper coverage report.
6
-
7
- Background:
8
- Given SimpleCov for Test/Unit is configured with:
9
- """
10
- require 'simplecov'
11
- SimpleCov.start 'test_frameworks'
12
- """
13
-
14
- Scenario: Snowman inside method string
15
- Given a file named "lib/faked_project/unicode.rb" with:
16
- """
17
- # encoding: UTF-8
18
- class SourceCodeWithUnicode
19
- def self.yell!
20
- puts "☃"
21
- end
22
- end
23
- """
24
-
25
- When I open the coverage report generated with `bundle exec rake test`
26
- Then I should see the groups:
27
- | name | coverage | files |
28
- | All Files | 86.67% | 5 |
29
-
30
- And I should see the source files:
31
- | name | coverage |
32
- | lib/faked_project.rb | 100.0 % |
33
- | lib/faked_project/some_class.rb | 80.0 % |
34
- | lib/faked_project/framework_specific.rb | 75.0 % |
35
- | lib/faked_project/meta_magic.rb | 100.0 % |
36
- | lib/faked_project/unicode.rb | 66.67 % |
37
-
38
- And the report should be based upon:
39
- | Unit Tests |
40
-
41
- Scenario: Author name in comment
42
- Given a file named "lib/faked_project/unicode.rb" with:
43
- """
44
- # encoding: UTF-8
45
- # author: Javiér Hernández
46
- class SomeClassWrittenByAForeigner
47
- def self.yell!
48
- foo
49
- end
50
- end
51
- """
52
-
53
- When I open the coverage report generated with `bundle exec rake test`
54
- Then I should see the groups:
55
- | name | coverage | files |
56
- | All Files | 86.67% | 5 |
57
-
58
- And I should see the source files:
59
- | name | coverage |
60
- | lib/faked_project.rb | 100.0 % |
61
- | lib/faked_project/some_class.rb | 80.0 % |
62
- | lib/faked_project/framework_specific.rb | 75.0 % |
63
- | lib/faked_project/meta_magic.rb | 100.0 % |
64
- | lib/faked_project/unicode.rb | 66.67 % |
65
-
66
- And the report should be based upon:
67
- | Unit Tests |
@@ -1,29 +0,0 @@
1
- #
2
- # Adapters are glorified SimpleCov configuration procs that can be easily
3
- # loaded using SimpleCov.start :rails and defined using
4
- # SimpleCov.adapters.define :foo do
5
- # # SimpleCov configuration here, same as in SimpleCov.configure
6
- # end
7
- #
8
- class SimpleCov::Adapters < Hash
9
- #
10
- # Define a SimpleCov adapter:
11
- # SimpleCov.adapters.define 'rails' do
12
- # # Same as SimpleCov.configure do .. here
13
- # end
14
- #
15
- def define(name, &blk)
16
- name = name.to_sym
17
- raise "SimpleCov Adapter '#{name}' is already defined" unless self[name].nil?
18
- self[name] = blk
19
- end
20
-
21
- #
22
- # Applies the adapter of given name on SimpleCov.configure
23
- #
24
- def load(name)
25
- name = name.to_sym
26
- raise "Could not find SimpleCov Adapter called '#{name}'" unless has_key?(name)
27
- SimpleCov.configure(&self[name])
28
- end
29
- end
@@ -1,39 +0,0 @@
1
- module SimpleCov::ArrayMergeHelper
2
- # Merges an array of coverage results with self
3
- def merge_resultset(array)
4
- new_array = []
5
-
6
- self.each_with_index do |element, i|
7
- new_array[i] = element
8
- end
9
-
10
- array.each_with_index do |element, i|
11
- if element.nil? and new_array[i].nil?
12
- new_array[i] = nil
13
- else
14
- local_value = element || 0
15
- other_value = new_array[i] || 0
16
- new_array[i] = local_value + other_value
17
- end
18
- end
19
- new_array
20
- end
21
- end
22
-
23
- module SimpleCov::HashMergeHelper
24
- # Merges the given Coverage.result hash with self
25
- def merge_resultset(hash)
26
- new_resultset = {}
27
- (self.keys + hash.keys).each do |filename|
28
- new_resultset[filename] = []
29
- end
30
-
31
- new_resultset.each do |filename, data|
32
- new_resultset[filename] = (self[filename] || []).merge_resultset(hash[filename] || [])
33
- end
34
- new_resultset
35
- end
36
- end
37
-
38
- Array.send :include, SimpleCov::ArrayMergeHelper
39
- Hash.send :include, SimpleCov::HashMergeHelper
@@ -1,7 +0,0 @@
1
- module SimpleCov
2
- class Railtie < ::Rails::Railtie
3
- rake_tasks do
4
- load 'simplecov/railties/tasks.rake'
5
- end
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- require 'rake/testtask'
2
- Rake::TestTask.new do |t|
3
- t.name = 'simplecov'
4
- t.loader = :direct # uses require() which skips PWD in Ruby 1.9
5
- t.libs.push 'test', 'spec', Dir.pwd
6
- t.test_files = FileList['{test,spec}/**/*_{test,spec}.rb']
7
- t.ruby_opts.push '-r', 'simplecov', '-e', 'SimpleCov.start(:rails)'.inspect
8
- end
9
-
10
- require 'rake/clean'
11
- CLOBBER.include 'coverage'
data/simplecov.gemspec DELETED
@@ -1,28 +0,0 @@
1
- # encoding: utf-8
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'simplecov/version'
4
-
5
- Gem::Specification.new do |gem|
6
- gem.name = 'simplecov'
7
- gem.version = SimpleCov::VERSION
8
- gem.platform = Gem::Platform::RUBY
9
- gem.authors = ["Christoph Olszowka"]
10
- gem.email = ['christoph at olszowka de']
11
- gem.homepage = 'http://github.com/colszowka/simplecov'
12
- gem.description = %Q{Code coverage for Ruby 1.9 with a powerful configuration library and automatic merging of coverage across test suites}
13
- gem.summary = gem.description
14
-
15
- gem.add_dependency 'multi_json', '~> 1.0'
16
- gem.add_dependency 'simplecov-html', '~> 0.5.3'
17
- gem.add_development_dependency 'aruba'
18
- gem.add_development_dependency 'capybara'
19
- gem.add_development_dependency 'cucumber', '>= 1.1.4'
20
- gem.add_development_dependency 'rake'
21
- gem.add_development_dependency 'rspec'
22
- gem.add_development_dependency 'shoulda'
23
-
24
- gem.files = `git ls-files`.split("\n")
25
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
- gem.require_paths = ['lib']
28
- end
@@ -1,6 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'simplecov', :path => '../../../'
4
- gem 'rake'
5
- gem 'rspec', '>= 2.6.0'
6
- gem 'cucumber'
@@ -1,8 +0,0 @@
1
- require 'bundler'
2
-
3
- require 'rake/testtask'
4
- Rake::TestTask.new(:test) do |test|
5
- test.libs << 'lib' << 'test'
6
- test.test_files = FileList['test/**/*_test.rb'].sort
7
- test.verbose = true
8
- end
@@ -1,13 +0,0 @@
1
- <%
2
- rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
- rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
- std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
5
- interp_opts = if defined?(RUBY_ENGINE)
6
- " --tags ~@exclude-#{RUBY_ENGINE}"
7
- else
8
- ''
9
- end
10
- %>
11
- default: <%= std_opts %><%= interp_opts %> features
12
- wip: --tags @wip:30 --wip features<%= interp_opts %>
13
- rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip<%= interp_opts %>
@@ -1,23 +0,0 @@
1
- Given /^I want to keep stuff simple$/ do
2
- 1.should == 1
3
- end
4
-
5
- When /^I write my cukes for the fake project$/ do
6
- 1.should == 1
7
- end
8
-
9
- Then /^I make all neccessary tests in a single step$/ do
10
- FakedProject.foo.should == 'bar'
11
-
12
- FrameworkSpecific.cucumber.should == "Only tested in Cucumber"
13
-
14
- FakedProject.a_class_method.should == "this is a mixed-in class method"
15
-
16
- FakedProject.new.an_instance_method.should == "this is a mixed-in instance method"
17
- FakedProject.new.dynamic.should == "A dynamically defined instance method"
18
-
19
- something = SomeClass.new("foo")
20
- something.reverse.should == 'oof'
21
- something.compare_with('foo').should be_true
22
- end
23
-
@@ -1,12 +0,0 @@
1
- require 'bundler/setup'
2
-
3
- # We're injecting simplecov_config via aruba in cucumber here
4
- # depending on what the test case is...
5
- begin
6
- require File.join(File.dirname(__FILE__), 'simplecov_config')
7
- rescue LoadError => err
8
- $stderr.puts "No SimpleCov config file found!"
9
- end
10
-
11
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../../lib'))
12
- require 'faked_project'
@@ -1,6 +0,0 @@
1
- Feature: Foo
2
-
3
- Scenario: Test stuff
4
- Given I want to keep stuff simple
5
- When I write my cukes for the fake project
6
- Then I make all neccessary tests in a single step
@@ -1,18 +0,0 @@
1
- # A pile of methods that only get tested in their frameworks
2
- # and thus make this file only 100% covered when all framework test
3
- # results are merged
4
- module FrameworkSpecific
5
- class << self
6
- def cucumber
7
- "Only tested in Cucumber"
8
- end
9
-
10
- def rspec
11
- "Only tested in RSpec"
12
- end
13
-
14
- def test_unit
15
- "Only tested in Test/Unit"
16
- end
17
- end
18
- end
@@ -1,24 +0,0 @@
1
- module MetaMagic
2
- module ClassMethods
3
- def a_class_method
4
- "this is a mixed-in class method"
5
- end
6
- end
7
-
8
- module InstanceMethods
9
- def an_instance_method
10
- "this is a mixed-in instance method"
11
- end
12
- end
13
-
14
- def self.included(base)
15
- base.send :extend, ClassMethods
16
- base.send :include, InstanceMethods
17
-
18
- base.class_eval do
19
- define_method :dynamic do
20
- "A dynamically defined instance method"
21
- end
22
- end
23
- end
24
- end
@@ -1,29 +0,0 @@
1
- class SomeClass
2
- attr_reader :label
3
- attr_accessor :some_attr
4
-
5
- def initialize(label)
6
- @label = label
7
- end
8
-
9
- def reverse
10
- label.reverse
11
- end
12
-
13
- def compare_with(item)
14
- if item == label
15
- return true
16
- else
17
- raise "Item does not match label"
18
- end
19
-
20
- rescue => err
21
- false
22
- end
23
-
24
- private
25
-
26
- def uncovered
27
- "private method"
28
- end
29
- end
@@ -1,11 +0,0 @@
1
- class FakedProject
2
- def self.foo
3
- "bar"
4
- end
5
- end
6
-
7
- Dir[File.join(File.dirname(__FILE__), 'faked_project/*.rb')].each do |file|
8
- require file # Require all source files in project dynamically so we can inject some stuff depending on test situation
9
- end
10
-
11
- FakedProject.send :include, MetaMagic
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FakedProject do
4
- it "should return proper foo" do
5
- FakedProject.foo.should == 'bar'
6
- end
7
-
8
- it "should test it's framework specific method" do
9
- FrameworkSpecific.rspec.should == "Only tested in RSpec"
10
- end
11
- end
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FakedProject do
4
- it "should have added a class method to FakedProject" do
5
- FakedProject.a_class_method.should == "this is a mixed-in class method"
6
- end
7
-
8
- its(:an_instance_method) { should == "this is a mixed-in instance method" }
9
- its(:dynamic) { should == "A dynamically defined instance method" }
10
- end
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SomeClass do
4
- subject { SomeClass.new("foo") }
5
-
6
- its(:reverse) { should == 'oof' }
7
- it "should compare with 'foo'" do
8
- subject.compare_with('foo').should be_true
9
- end
10
- end
@@ -1,15 +0,0 @@
1
- require 'bundler/setup'
2
-
3
- # We're injecting simplecov_config via aruba in cucumber here
4
- # depending on what the test case is...
5
- begin
6
- require File.join(File.dirname(__FILE__), 'simplecov_config')
7
- rescue LoadError => err
8
- $stderr.puts "No SimpleCov config file found!"
9
- end
10
-
11
- require 'faked_project'
12
-
13
- RSpec.configure do |config|
14
- # some (optional) config here
15
- end
@@ -1,11 +0,0 @@
1
- require 'test_helper'
2
-
3
- class FakedTest < Test::Unit::TestCase
4
- def test_something
5
- assert_equal 'bar', FakedProject.foo
6
- end
7
-
8
- def test_framework_specific
9
- assert_equal "Only tested in Test/Unit", FrameworkSpecific.test_unit
10
- end
11
- end