foca-foca-storyteller 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,91 @@
1
+ Storyteller
2
+ ===========
3
+
4
+ Minimalist user stories for test/unit
5
+
6
+ Examples
7
+ --------
8
+
9
+ require "test/unit"
10
+ require "rubygems"
11
+ require "context"
12
+ require "storyteller"
13
+
14
+ class MyAcceptanceTest < Test::Unit::TestCase
15
+ include Test::Storyteller
16
+
17
+ story <<-EOS
18
+ As a developer
19
+ I want to have user stories on test/unit that look pretty
20
+ So that I can have nice acceptance tests
21
+ EOS
22
+
23
+ scenario "So simple it's awesome" do
24
+ # ...
25
+ end
26
+
27
+ scenario "OMG I'm so ruling the world with this" do
28
+ # ...
29
+ end
30
+ end
31
+
32
+ And when run that produces:
33
+
34
+ $ ruby my_acceptance_test.rb
35
+ Loaded suite my_acceptance_test
36
+ Started
37
+
38
+ As a developer
39
+ I want to have user stories on test/unit that look pretty
40
+ So that I can have nice acceptance tests
41
+ ..
42
+
43
+ Finished in 0.000178 seconds.
44
+
45
+ 2 tests, 0 assertions, 0 failures, 0 errors
46
+
47
+ If you have multiple classes that include Test::Storyteller (or that inherit
48
+ from a common base class that includes it), then each story will get printed
49
+ in turn, with the scenarios run below it.
50
+
51
+ And best of all: **in full beautiful color** (cause what's the point if it
52
+ ain't pretty?)
53
+
54
+ Installing
55
+ ==========
56
+
57
+ sudo gem sources add http://gems.github.com
58
+ sudo gem install foca-storyteller
59
+
60
+ OMG why not use Cucumber?
61
+ =========================
62
+
63
+ I like Cucumber and use it, but it's just a whole new layer of complexity when
64
+ you don't have business people checking and reviewing your user stories. Simple
65
+ requirements need simple solutions.
66
+
67
+ License
68
+ =======
69
+
70
+ (The MIT License)
71
+
72
+ Copyright (c) 2009 Nicolás Sanguinetti <contacto@nicolassanguinetti.info>
73
+
74
+ Permission is hereby granted, free of charge, to any person obtaining
75
+ a copy of this software and associated documentation files (the
76
+ 'Software'), to deal in the Software without restriction, including
77
+ without limitation the rights to use, copy, modify, merge, publish,
78
+ distribute, sublicense, and/or sell copies of the Software, and to
79
+ permit persons to whom the Software is furnished to do so, subject to
80
+ the following conditions:
81
+
82
+ The above copyright notice and this permission notice shall be
83
+ included in all copies or substantial portions of the Software.
84
+
85
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
88
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
89
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
90
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
91
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,18 @@
1
+ begin
2
+ require "rubygems"
3
+ require "jeweler"
4
+
5
+ Jeweler::Tasks.new do |s|
6
+ s.name = 'storyteller'
7
+ s.summary = 'Minimalist user story runner on top of test/unit'
8
+ s.description = 'Minimalist user story runner on top of test/unit'
9
+ s.homepage = 'http://nicolassanguinetti.info'
10
+ s.rubyforge_project = 'storyteller'
11
+ s.email = 'contacto@nicolassanguinetti.info'
12
+ s.authors = ['Nicolás Sanguinetti']
13
+ s.files = FileList["**/*"]
14
+
15
+ s.add_dependency 'jeremymcanally-context'
16
+ end
17
+ rescue LoadError
18
+ end
@@ -0,0 +1,4 @@
1
+ ---
2
+ major: 0
3
+ patch: 1
4
+ minor: 1
@@ -0,0 +1,66 @@
1
+ require "rubygems"
2
+ require "context"
3
+
4
+ module Test
5
+ # Including Storyteller in your TestCase allows you to declare a user story
6
+ # (global to the entire test case) and then run `scenarios' (tests) regarding
7
+ # that user story
8
+ #
9
+ # For example:
10
+ #
11
+ # class MyTestCase < Test::Unit::TestCase
12
+ # include Test::Storyteller
13
+ #
14
+ # story <<-EOS
15
+ # As a <role>
16
+ # I want to <feature>
17
+ # So that <profit>
18
+ # EOS
19
+ #
20
+ # scenario "some scenario description" do
21
+ # ...
22
+ # end
23
+ # end
24
+ module Storyteller
25
+ def self.included(base)
26
+ base.before(:all) do
27
+ puts
28
+ print Storyteller.color.first
29
+ print self.class.story.to_s.gsub(/^\s+/, '')
30
+ print Storyteller.color.last
31
+ end
32
+
33
+ base.after(:all) do
34
+ puts
35
+ end
36
+
37
+ class << base
38
+ alias :scenario :test
39
+ end
40
+
41
+ base.extend ClassMethods
42
+ end
43
+
44
+ module ClassMethods
45
+ def story(story=nil)
46
+ @story = story if story
47
+ @story
48
+ end
49
+ end
50
+
51
+ def self.color=(color)
52
+ if color
53
+ @start_color = "\e[#{color}m"
54
+ @end_color = "\e[0m"
55
+ else
56
+ @start_color = @end_color = nil
57
+ end
58
+ end
59
+
60
+ def self.color
61
+ [@start_color, @end_color]
62
+ end
63
+
64
+ self.color = 36 # cyan
65
+ end
66
+ end
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{foca-storyteller}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Nicol\303\241s Sanguinetti"]
9
+ s.date = %q{2008-12-30}
10
+ s.description = %q{Minimalist user story runner on top of test/unit}
11
+ s.email = %q{contacto@nicolassanguinetti.info}
12
+ s.files = ["lib", "lib/storyteller.rb", "Rakefile", "README.markdown", "storyteller.gemspec", "VERSION.yml"]
13
+ s.homepage = %q{http://nicolassanguinetti.info}
14
+ s.require_paths = ["lib"]
15
+ s.rubyforge_project = %q{storyteller}
16
+ s.rubygems_version = %q{1.3.1}
17
+ s.summary = %q{Minimalist user story runner on top of test/unit}
18
+
19
+ if s.respond_to? :specification_version then
20
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
21
+ s.specification_version = 2
22
+
23
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
24
+ s.add_runtime_dependency(%q<jeremymcanally-context>, [">= 0"])
25
+ else
26
+ s.add_dependency(%q<jeremymcanally-context>, [">= 0"])
27
+ end
28
+ else
29
+ s.add_dependency(%q<jeremymcanally-context>, [">= 0"])
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: foca-foca-storyteller
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - "Nicol\xC3\xA1s Sanguinetti"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-30 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: jeremymcanally-context
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description: Minimalist user story runner on top of test/unit
25
+ email: contacto@nicolassanguinetti.info
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
32
+ files:
33
+ - lib
34
+ - lib/storyteller.rb
35
+ - Rakefile
36
+ - README.markdown
37
+ - storyteller.gemspec
38
+ - VERSION.yml
39
+ has_rdoc: false
40
+ homepage: http://nicolassanguinetti.info
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ requirements: []
59
+
60
+ rubyforge_project: storyteller
61
+ rubygems_version: 1.2.0
62
+ signing_key:
63
+ specification_version: 2
64
+ summary: Minimalist user story runner on top of test/unit
65
+ test_files: []
66
+