scenario 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,8 +2,8 @@ source "http://rubygems.org"
2
2
 
3
3
  group :development do
4
4
  gem "rspec", "~> 2.3.0"
5
+ # gem "rspec", "~> 1.3.2"
5
6
  gem "yard", "~> 0.6.0"
6
7
  gem "bundler", "~> 1.0.0"
7
8
  gem "jeweler", "~> 1.5.2"
8
- gem "rcov", ">= 0"
9
9
  end
@@ -8,7 +8,6 @@ GEM
8
8
  git (>= 1.2.5)
9
9
  rake
10
10
  rake (0.8.7)
11
- rcov (0.9.9)
12
11
  rspec (2.3.0)
13
12
  rspec-core (~> 2.3.0)
14
13
  rspec-expectations (~> 2.3.0)
@@ -25,6 +24,5 @@ PLATFORMS
25
24
  DEPENDENCIES
26
25
  bundler (~> 1.0.0)
27
26
  jeweler (~> 1.5.2)
28
- rcov
29
27
  rspec (~> 2.3.0)
30
28
  yard (~> 0.6.0)
@@ -6,80 +6,90 @@ block or by passing in a Module (or even both).
6
6
 
7
7
  Block:
8
8
 
9
- describe_scenario :admin do |scenario|
10
- define :setup_user do |name|
11
- User.create( :name => name, :admin => true )
12
- end
13
- end
14
-
15
- describe "Admin pages" do
16
- scenario :admin
17
-
18
- ...
19
- end
9
+ ```ruby
10
+ describe_scenario :admin do
11
+ define :setup_user do |name|
12
+ User.create( :name => name, :admin => true )
13
+ end
14
+ end
15
+
16
+ describe "Admin pages" do
17
+ scenario :admin
18
+
19
+ ...
20
+ end
21
+ ```
20
22
 
21
23
  Module:
22
24
 
23
- module AdminMethods
24
- def setup_user( name )
25
- User.create( :name => name, :admin => true )
26
- end
27
- end
28
-
29
- describe_scenario :admin, AdminMethods
30
-
31
- describe "Admin pages" do
32
- scenario :admin
33
-
34
- ...
35
- end
25
+ ```ruby
26
+ module AdminMethods
27
+ def setup_user( name )
28
+ User.create( :name => name, :admin => true )
29
+ end
30
+ end
31
+
32
+ describe_scenario :admin, AdminMethods
33
+
34
+ describe "Admin pages" do
35
+ scenario :admin
36
+
37
+ ...
38
+ end
39
+ ```
36
40
 
37
41
  Both:
38
42
 
39
- module AdminMethods
40
- def setup_user( name )
41
- User.create( :name => name, :admin => true )
42
- end
43
- end
44
-
45
- describe_scenario :admin, AdminMethods do
46
- define :admin?( user )
47
- user.admin == true
48
- end
49
- end
50
-
51
- describe "Admin pages" do
52
- scenario :admin
53
-
54
- ...
55
- end
43
+ ```ruby
44
+ module AdminMethods
45
+ def setup_user( name )
46
+ User.create( :name => name, :admin => true )
47
+ end
48
+ end
49
+
50
+ describe_scenario :admin, AdminMethods do
51
+ define :admin?( user )
52
+ user.admin == true
53
+ end
54
+ end
55
+
56
+ describe "Admin pages" do
57
+ scenario :admin
58
+
59
+ ...
60
+ end
61
+ ```
56
62
 
57
63
  Because scenarios are just Modules, you can use as many as you want:
58
64
 
59
- describe "Admin pages" do
60
- scenario :users
61
- scenario :admin
62
-
63
- ...
64
- end
65
+ ```ruby
66
+ describe "Admin pages" do
67
+ scenario :users
68
+ scenario :admin
69
+
70
+ ...
71
+ end
72
+ ```
65
73
 
66
74
  And you can nest them:
67
75
 
68
- describe "Login" do
69
- scenario :login
70
-
71
- describe "as an admin" do
72
- scenario :admin
73
-
74
- ...
75
- end
76
-
77
- describe "as a regular user" do
78
- scenario :user
79
-
80
- ...
81
- end
82
- end
76
+ ```ruby
77
+ describe "Login" do
78
+ scenario :login
79
+
80
+ describe "as an admin" do
81
+ scenario :admin
82
+
83
+ ...
84
+ end
85
+
86
+ describe "as a regular user" do
87
+ scenario :user
88
+
89
+ ...
90
+ end
91
+ end
92
+ ```
83
93
 
84
94
  Fixtures
85
95
  --------
@@ -89,12 +99,20 @@ hard-coded to `spec/scenarios/fixtures`. It will be configurable in a future
89
99
  version. Feel free to open a pull request or just monkey patch the `root()`
90
100
  method.
91
101
 
92
- Scenario::Fixtures['html/sample.html'] # Returns contents of the
93
- # fixture as a string
102
+ ```ruby
103
+ Scenario::Fixtures['html/sample.html'] # Returns contents of the fixture as
104
+ # a string
105
+ ```
94
106
 
95
107
  `Scenario::Fixtures` caches the contents of the file so that the file only needs
96
108
  to be read once.
97
109
 
110
+ Version History
111
+ ===============
112
+
113
+ 0.2.0 - Add support for RSpec 1.3+
114
+ 0.1.0 - Initial release with support for RSpec 2.x
115
+
98
116
  Contributing to Scenario
99
117
  ========================
100
118
 
data/Rakefile CHANGED
@@ -9,6 +9,10 @@ rescue Bundler::BundlerError => e
9
9
  end
10
10
  require 'rake'
11
11
 
12
+ # ===========
13
+ # = Jeweler =
14
+ # ===========
15
+
12
16
  require 'jeweler'
13
17
  Jeweler::Tasks.new do |gem|
14
18
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
@@ -19,26 +23,38 @@ Jeweler::Tasks.new do |gem|
19
23
  gem.description = %Q{Basic spec scenarios for RSpec. Also includes basic fixtures support.}
20
24
  gem.email = "tyson@tysontate.com"
21
25
  gem.authors = ["Tyson Tate"]
22
- gem.add_development_dependency "rspec", "~> 2.3.0"
23
- gem.add_development_dependency "yard", "~> 0.6.0"
24
- gem.add_development_dependency "bundler", "~> 1.0.0"
25
- gem.add_development_dependency "jeweler", "~> 1.5.2"
26
- gem.add_development_dependency "rcov", ">= 0"
26
+ gem.add_dependency "rspec", ">= 1.3"
27
27
  end
28
28
  Jeweler::RubygemsDotOrgTasks.new
29
29
 
30
- require 'rspec/core'
31
- require 'rspec/core/rake_task'
32
- RSpec::Core::RakeTask.new(:spec) do |spec|
33
- spec.pattern = FileList['spec/**/*_spec.rb']
34
- end
30
+ # =========
31
+ # = Specs =
32
+ # =========
35
33
 
36
- RSpec::Core::RakeTask.new(:rcov) do |spec|
37
- spec.pattern = 'spec/**/*_spec.rb'
38
- spec.rcov = true
34
+ spec_files = FileList['spec/**/*_spec.rb']
35
+ begin
36
+ # 2.x
37
+ require 'rspec/core'
38
+ require 'rspec/core/rake_task'
39
+ RSpec::Core::RakeTask.new(:spec) do |spec|
40
+ spec.pattern = spec_files
41
+ spec.rspec_opts = ["--format", "documentation"]
42
+ end
43
+ rescue LoadError
44
+ # 1.x
45
+ require 'spec'
46
+ require 'spec/rake/spectask'
47
+ Spec::Rake::SpecTask.new(:spec) do |spec|
48
+ spec.pattern = spec_files
49
+ spec.spec_opts = ["--format", "specdoc"]
50
+ end
39
51
  end
40
52
 
41
53
  task :default => :spec
42
54
 
55
+ # ========
56
+ # = Docs =
57
+ # ========
58
+
43
59
  require 'yard'
44
60
  YARD::Rake::YardocTask.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -6,6 +6,12 @@ module Scenario
6
6
 
7
7
  private
8
8
 
9
+ begin
10
+ RSpecExampleGroup = RSpec::Core::ExampleGroup
11
+ rescue NameError
12
+ RSpecExampleGroup = Spec::Example::ExampleGroup
13
+ end
14
+
9
15
  module RSpecExtensions
10
16
 
11
17
  # ExampleGroup methods
@@ -19,7 +25,7 @@ module Scenario
19
25
  end
20
26
 
21
27
  end
22
- RSpec::Core::ExampleGroup.send :extend, Scenario::RSpecExtensions::ExampleGroupExtensions
28
+ RSpecExampleGroup.send :extend, Scenario::RSpecExtensions::ExampleGroupExtensions
23
29
 
24
30
  # Global methods.
25
31
  module ObjectExtensions
@@ -0,0 +1,75 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{scenario}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tyson Tate"]
12
+ s.date = %q{2011-05-20}
13
+ s.description = %q{Basic spec scenarios for RSpec. Also includes basic fixtures support.}
14
+ s.email = %q{tyson@tysontate.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.markdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.markdown",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "lib/scenario.rb",
29
+ "lib/scenario/fixtures.rb",
30
+ "lib/scenario/rspec.rb",
31
+ "lib/scenario/scenario.rb",
32
+ "scenario.gemspec",
33
+ "spec/fixtures_spec.rb",
34
+ "spec/scenario_spec.rb",
35
+ "spec/scenarios/fixtures/basic.text",
36
+ "spec/scenarios/test_scenarios.rb",
37
+ "spec/spec_helper.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/tysontate/scenario}
40
+ s.licenses = ["MIT"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.4.2}
43
+ s.summary = %q{Basic spec scenarios for RSpec.}
44
+ s.test_files = [
45
+ "spec/fixtures_spec.rb",
46
+ "spec/scenario_spec.rb",
47
+ "spec/scenarios/test_scenarios.rb",
48
+ "spec/spec_helper.rb"
49
+ ]
50
+
51
+ if s.respond_to? :specification_version then
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
56
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
57
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
59
+ s.add_runtime_dependency(%q<rspec>, [">= 1.3"])
60
+ else
61
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
62
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
65
+ s.add_dependency(%q<rspec>, [">= 1.3"])
66
+ end
67
+ else
68
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
69
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
70
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
71
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
72
+ s.add_dependency(%q<rspec>, [">= 1.3"])
73
+ end
74
+ end
75
+
@@ -1,4 +1,10 @@
1
1
  $LOAD_PATH.unshift( File.join( File.dirname( __FILE__ ), '..', 'lib' ) )
2
2
 
3
- require 'rspec'
3
+ begin
4
+ # 2.x
5
+ require 'rspec'
6
+ rescue LoadError
7
+ # 1.x
8
+ require 'spec'
9
+ end
4
10
  require 'scenario'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scenario
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyson Tate
@@ -84,96 +84,19 @@ dependencies:
84
84
  requirement: *id004
85
85
  - !ruby/object:Gem::Dependency
86
86
  prerelease: false
87
- name: rcov
88
- type: :development
87
+ name: rspec
88
+ type: :runtime
89
89
  version_requirements: &id005 !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
- version: "0"
98
- requirement: *id005
99
- - !ruby/object:Gem::Dependency
100
- prerelease: false
101
- name: rspec
102
- type: :development
103
- version_requirements: &id006 !ruby/object:Gem::Requirement
104
- none: false
105
- requirements:
106
- - - ~>
107
- - !ruby/object:Gem::Version
108
- hash: 3
109
- segments:
110
- - 2
111
- - 3
112
- - 0
113
- version: 2.3.0
114
- requirement: *id006
115
- - !ruby/object:Gem::Dependency
116
- prerelease: false
117
- name: yard
118
- type: :development
119
- version_requirements: &id007 !ruby/object:Gem::Requirement
120
- none: false
121
- requirements:
122
- - - ~>
123
- - !ruby/object:Gem::Version
124
- hash: 7
125
- segments:
126
- - 0
127
- - 6
128
- - 0
129
- version: 0.6.0
130
- requirement: *id007
131
- - !ruby/object:Gem::Dependency
132
- prerelease: false
133
- name: bundler
134
- type: :development
135
- version_requirements: &id008 !ruby/object:Gem::Requirement
136
- none: false
137
- requirements:
138
- - - ~>
139
- - !ruby/object:Gem::Version
140
- hash: 23
141
- segments:
142
- - 1
143
- - 0
144
- - 0
145
- version: 1.0.0
146
- requirement: *id008
147
- - !ruby/object:Gem::Dependency
148
- prerelease: false
149
- name: jeweler
150
- type: :development
151
- version_requirements: &id009 !ruby/object:Gem::Requirement
152
- none: false
153
- requirements:
154
- - - ~>
155
- - !ruby/object:Gem::Version
156
- hash: 7
94
+ hash: 9
157
95
  segments:
158
96
  - 1
159
- - 5
160
- - 2
161
- version: 1.5.2
162
- requirement: *id009
163
- - !ruby/object:Gem::Dependency
164
- prerelease: false
165
- name: rcov
166
- type: :development
167
- version_requirements: &id010 !ruby/object:Gem::Requirement
168
- none: false
169
- requirements:
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- hash: 3
173
- segments:
174
- - 0
175
- version: "0"
176
- requirement: *id010
97
+ - 3
98
+ version: "1.3"
99
+ requirement: *id005
177
100
  description: Basic spec scenarios for RSpec. Also includes basic fixtures support.
178
101
  email: tyson@tysontate.com
179
102
  executables: []
@@ -196,6 +119,7 @@ files:
196
119
  - lib/scenario/fixtures.rb
197
120
  - lib/scenario/rspec.rb
198
121
  - lib/scenario/scenario.rb
122
+ - scenario.gemspec
199
123
  - spec/fixtures_spec.rb
200
124
  - spec/scenario_spec.rb
201
125
  - spec/scenarios/fixtures/basic.text