generative 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cb07b72eae577b93f0b1a1ad07c359febd371b2a
4
+ data.tar.gz: 546a72740dba23846335a260cd990b869475e9a6
5
+ SHA512:
6
+ metadata.gz: e05ce694896ac75dbd22283c29bcf7ff6900d5928ddebbf907184944f1098c2a34c02f75d14866c0c72385a56796163307765c4cd655911379948b400e2c1d91
7
+ data.tar.gz: 1af5f8fd24a3449a28c602d8be2cf33299aef47c647851f0ff3aa123252a66b3c401da015f561b7f5688cc5c9fc93734f3969337531d4320744bb9929c1cba4e
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
+ env:
3
+ - RSPEC_VERSION=2
4
+ - RSPEC_VERSION=3
2
5
  rvm:
3
6
  - 1.9.3
4
7
  - 2.0.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ * Add support for RSpec 2
6
+
7
+ ## 0.0.1
8
+
9
+ * Initial release
data/README.md CHANGED
@@ -7,17 +7,17 @@
7
7
 
8
8
  ## Installation
9
9
 
10
- You're already using RSpec 3, right? Of course you are.
11
-
12
- ### Add Generative to your Gemfile:
10
+ ### Add Generative to your Gemfile (or gemspec):
13
11
 
14
12
  ```rb
15
13
  group :test do
16
14
  gem 'generative'
17
- gem 'rspec', '3.0.0.beta1'
15
+ gem 'rspec'
18
16
  end
19
17
  ```
20
18
 
19
+ ...and then run `bundle`.
20
+
21
21
  ### Require Generative in your `.rspec` file:
22
22
 
23
23
  ```
@@ -32,19 +32,26 @@ end
32
32
  require 'bundler/gem_tasks'
33
33
  require 'rspec/core/rake_task'
34
34
 
35
- ENV['GENERATIVE_COUNT'] = '10_000'
36
-
37
35
  task default: [:spec, :generative]
38
36
 
39
37
  RSpec::Core::RakeTask.new(:spec) do |t|
40
- t.rspec_opts = '--format documentation --tag ~generative'
38
+ t.rspec_opts = '--format documentation --tag ~generative --order random'
41
39
  end
42
40
 
43
41
  RSpec::Core::RakeTask.new(:generative) do |t|
42
+ ENV['GENERATIVE_COUNT'] = '10_000'
44
43
  t.rspec_opts = '--format Generative --tag generative'
45
44
  end
46
45
  ```
47
46
 
47
+ ### Remove any random/other ordering
48
+
49
+ If using RSpec 2, you'll need to make sure you remove `config.order =
50
+ 'random'`, or any other ordering strategies, from your spec helper.
51
+
52
+ In RSpec 3, this is not nessecary, because each example group (the `generative`
53
+ block) can override ordering for that group.
54
+
48
55
  ## Usage
49
56
 
50
57
  ### Specs
data/Rakefile CHANGED
@@ -1,14 +1,13 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
- ENV['GENERATIVE_COUNT'] = '10_000'
5
-
6
4
  task default: [:spec, :generative]
7
5
 
8
6
  RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.rspec_opts = '--format documentation --tag ~generative'
7
+ t.rspec_opts = '--format documentation --tag ~generative --order random'
10
8
  end
11
9
 
12
10
  RSpec::Core::RakeTask.new(:generative) do |t|
11
+ ENV['GENERATIVE_COUNT'] ||= '10_000'
13
12
  t.rspec_opts = '--format Generative --tag generative'
14
13
  end
data/generative.gemspec CHANGED
@@ -4,18 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'generative'
7
- gem.version = '0.0.1'
8
- gem.authors = ["Justin Campbell"]
9
- gem.email = ["justin@justincampbell.me"]
7
+ gem.version = '0.1.0'
8
+ gem.authors = ["Justin Campbell", "Dan McClory"]
9
+ gem.email = ["justin@justincampbell.me", "danmcclory@gmail.com"]
10
10
  gem.description = "Generative testing for RSpec"
11
11
  gem.summary = "Generative testing for RSpec"
12
12
  gem.homepage = "https://github.com/justincampbell/generative"
13
+ gem.license = 'MIT'
13
14
 
14
15
  gem.files = `git ls-files`.split($/)
15
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
17
  gem.require_paths = ["lib"]
17
18
 
18
- gem.add_dependency 'rspec', '3.0.0.beta1'
19
+ case ENV['RSPEC_VERSION']
20
+ when '2'
21
+ gem.add_dependency 'rspec', '~> 2.0'
22
+ when '3'
23
+ gem.add_dependency 'rspec', '3.0.0.beta1'
24
+ else
25
+ gem.add_dependency 'rspec'
26
+ end
19
27
 
20
28
  gem.add_development_dependency 'rake'
21
29
  end
@@ -55,7 +55,6 @@ class Generative < RSpec::Core::Formatters::DocumentationFormatter
55
55
  def example_failed(example)
56
56
  if generative?(example)
57
57
  RSpec.wants_to_quit = true
58
- return
59
58
  end
60
59
 
61
60
  super(example)
@@ -1,7 +1,15 @@
1
- RSpec.configure do |rspec|
2
- rspec.register_ordering :generative do |examples|
3
- number_of_examples = ENV.fetch('GENERATIVE_COUNT', '100').to_i
1
+ Generative::ORDERING = ->(examples) {
2
+ number_of_examples = ENV.fetch('GENERATIVE_COUNT', '1').to_i
3
+ examples * number_of_examples
4
+ }
4
5
 
5
- examples * number_of_examples
6
+ RSpec.configure do |rspec|
7
+ case RSpec::Core::Version::STRING
8
+ when /^2/
9
+ rspec.order_examples(&Generative::ORDERING) if ENV['GENERATIVE_COUNT']
10
+ when /^3/
11
+ rspec.register_ordering(:generative, &Generative::ORDERING)
12
+ else
13
+ puts "Generative was unable to determine the RSpec version."
6
14
  end
7
15
  end
@@ -13,7 +13,7 @@ describe String do
13
13
  generative do
14
14
  data(:string) { "a" * rand(255) }
15
15
 
16
- it "is never negative", :generative do
16
+ it "is never negative" do
17
17
  expect(string.length).to be >= 0
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,58 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generative
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Justin Campbell
8
+ - Dan McClory
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-21 00:00:00.000000000 Z
12
+ date: 2013-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - '='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: 3.0.0.beta1
20
+ version: '0'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - '='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
- version: 3.0.0.beta1
27
+ version: '0'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: rake
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ! '>='
32
+ - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: '0'
38
35
  type: :development
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - ">="
44
40
  - !ruby/object:Gem::Version
45
41
  version: '0'
46
42
  description: Generative testing for RSpec
47
43
  email:
48
44
  - justin@justincampbell.me
45
+ - danmcclory@gmail.com
49
46
  executables: []
50
47
  extensions: []
51
48
  extra_rdoc_files: []
52
49
  files:
53
- - .gitignore
54
- - .rspec
55
- - .travis.yml
50
+ - ".gitignore"
51
+ - ".rspec"
52
+ - ".travis.yml"
53
+ - CHANGELOG.md
56
54
  - Gemfile
57
55
  - LICENSE.txt
58
56
  - README.md
@@ -66,28 +64,28 @@ files:
66
64
  - spec/generative_spec.rb
67
65
  - spec/spec_helper.rb
68
66
  homepage: https://github.com/justincampbell/generative
69
- licenses: []
67
+ licenses:
68
+ - MIT
69
+ metadata: {}
70
70
  post_install_message:
71
71
  rdoc_options: []
72
72
  require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
- none: false
76
75
  requirements:
77
- - - ! '>='
76
+ - - ">="
78
77
  - !ruby/object:Gem::Version
79
78
  version: '0'
80
79
  required_rubygems_version: !ruby/object:Gem::Requirement
81
- none: false
82
80
  requirements:
83
- - - ! '>='
81
+ - - ">="
84
82
  - !ruby/object:Gem::Version
85
83
  version: '0'
86
84
  requirements: []
87
85
  rubyforge_project:
88
- rubygems_version: 1.8.23
86
+ rubygems_version: 2.2.0
89
87
  signing_key:
90
- specification_version: 3
88
+ specification_version: 4
91
89
  summary: Generative testing for RSpec
92
90
  test_files:
93
91
  - spec/generative_spec.rb