Commit fff4d71fcd4863b0cdc1854991984b54023d08fb
1 parent
eb8c9e54
Exists in
master
and in
1 other branch
vendoring cucumber gems
Showing
597 changed files
with
38975 additions
and
4 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 597 files displayed.
config/environments/cucumber.rb
... | ... | @@ -17,10 +17,32 @@ config.action_mailer.delivery_method = :test |
17 | 17 | |
18 | 18 | # rake gems:install RAILS_ENV=cucumber |
19 | 19 | |
20 | -config.gem "cucumber", | |
21 | - :version => "0.3.11" | |
22 | -config.gem "webrat", | |
23 | - :version => "0.4.4" | |
20 | +# Cucumber and dependencies | |
21 | +config.gem 'polyglot', | |
22 | + :version => '0.2.6', | |
23 | + :lib => false | |
24 | +config.gem 'treetop', | |
25 | + :version => '1.2.6', | |
26 | + :lib => false | |
27 | +config.gem 'term-ansicolor', | |
28 | + :version => '1.0.3', | |
29 | + :lib => false | |
30 | +config.gem 'diff-lcs', | |
31 | + :version => '1.1.2', | |
32 | + :lib => false | |
33 | +config.gem 'builder', | |
34 | + :version => '2.1.2', | |
35 | + :lib => false | |
36 | +config.gem 'cucumber', | |
37 | + :version => '0.3.11' | |
38 | + | |
39 | +# Webrat and dependencies | |
40 | +# NOTE: don't vendor nokogiri - it's a binary Gem | |
41 | +config.gem 'nokogiri', | |
42 | + :version => '1.3.2', | |
43 | + :lib => false | |
44 | +config.gem 'webrat', | |
45 | + :version => '0.4.4' | |
24 | 46 | |
25 | 47 | require 'rubygems' |
26 | 48 | require 'factory_girl' | ... | ... |
... | ... | @@ -0,0 +1,85 @@ |
1 | += Change Log | |
2 | + | |
3 | +== Version 2.1.2 | |
4 | + | |
5 | +* Fixed bug where private methods in kernel could leak through using | |
6 | + tag!(). Thanks to Hagen Overdick for finding and diagnosing this | |
7 | + bug. | |
8 | + | |
9 | + | |
10 | +== Version 2.1.1 | |
11 | + | |
12 | +* Fixed typo in XmlMarkup class docs (ident => indent). (from Martin | |
13 | + Fowler). | |
14 | +* Removed extra directory indirection from legacy CVS to SVN move. | |
15 | +* Removed some extraneous tabs from source. | |
16 | +* Fixed test on private methods in blankslate to differentiate between | |
17 | + targetted and untargetted private methods. | |
18 | +* Removed legacy capture of @self in XmlBase (@self was used back when | |
19 | + we used instance eval). | |
20 | +* Added additional tests for global functions (both direct and included). | |
21 | + | |
22 | +== Version 2.1.0 | |
23 | + | |
24 | +* Fixed bug in BlankSlate where including a module into Object could | |
25 | + cause methods to leak into BlankSlate. | |
26 | +* Made BlankSlate available as its own gem. Currently the builder gem | |
27 | + still directly includes the BlankSlate code. | |
28 | +* Added reveal capability to BlankSlate. | |
29 | + | |
30 | +== Version 2.0.0 | |
31 | + | |
32 | +* Added doc directory | |
33 | +* Added unit tests for XmlEvents. | |
34 | +* Added XChar module and used it in the _escape method. | |
35 | +* Attributes are now quoted by default when strings. Use Symbol | |
36 | + attribute values for unquoted behavior. | |
37 | + | |
38 | +== Version 1.2.4 | |
39 | + | |
40 | +* Added a cdata! command to an XML Builder (from Josh Knowles). | |
41 | + | |
42 | +== Version 1.2.3 | |
43 | + | |
44 | +The attributes in the <?xml ... ?> instruction will be ordered: | |
45 | +version, encoding, standalone. | |
46 | + | |
47 | +== Version 1.2.2 | |
48 | + | |
49 | +Another fix for BlankSlate. The Kernal/Object traps added in 1.2.1 | |
50 | +failed when a method was defined late more than once. Since the | |
51 | +method was already marked as removed, another attempt to undefine it | |
52 | +raised an error. The fix was to check the list of instance methods | |
53 | +before attempting the undef operation. Thanks to Florian Gross and | |
54 | +David Heinemeier Hansson for the patch. | |
55 | + | |
56 | +== Version 1.2.1 | |
57 | + | |
58 | +BlankSlate now traps method definitions in Kernel and Object to avoid | |
59 | +late method definitions inadvertently becoming part of the definition | |
60 | +of BlankSlate as well. | |
61 | + | |
62 | +== Version 1.2.0 | |
63 | + | |
64 | +Improved support for entity declarations by allowing nested | |
65 | +declarations and removal of the attribute processing. | |
66 | + | |
67 | +Added namespace support. | |
68 | + | |
69 | +== Version 1.1.0 | |
70 | + | |
71 | +Added support for comments, entity declarations and processing instructions. | |
72 | + | |
73 | +== Version 1.0.0 | |
74 | + | |
75 | +Removed use of <tt>instace_eval</tt> making the use of XmlMarkup much | |
76 | +less prone to error. | |
77 | + | |
78 | +== Version 0.1.1 | |
79 | + | |
80 | +Bug fix. | |
81 | + | |
82 | +== Version 0.1.0 | |
83 | + | |
84 | +Initial version release. | |
85 | + | ... | ... |
... | ... | @@ -0,0 +1,210 @@ |
1 | += Project: Builder | |
2 | + | |
3 | +== Goal | |
4 | + | |
5 | +Provide a simple way to create XML markup and data structures. | |
6 | + | |
7 | +== Classes | |
8 | + | |
9 | +Builder::XmlMarkup:: Generate XML markup notiation | |
10 | +Builder::XmlEvents:: Generate XML events (i.e. SAX-like) | |
11 | + | |
12 | +<b>Notes</b>:: | |
13 | + | |
14 | +* An <tt>Builder::XmlTree</tt> class to generate XML tree | |
15 | + (i.e. DOM-like) structures is also planned, but not yet implemented. | |
16 | + Also, the events builder is currently lagging the markup builder in | |
17 | + features. | |
18 | + | |
19 | +== Usage | |
20 | + | |
21 | + require 'rubygems' | |
22 | + require_gem 'builder', '~> 2.0' | |
23 | + | |
24 | + builder = Builder::XmlMarkup.new | |
25 | + xml = builder.person { |b| b.name("Jim"); b.phone("555-1234") } | |
26 | + xml #=> <person><name>Jim</name><phone>555-1234</phone></person> | |
27 | + | |
28 | +or | |
29 | + | |
30 | + require 'rubygems' | |
31 | + require_gem 'builder' | |
32 | + | |
33 | + builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2) | |
34 | + builder.person { |b| b.name("Jim"); b.phone("555-1234") } | |
35 | + # | |
36 | + # Prints: | |
37 | + # <person> | |
38 | + # <name>Jim</name> | |
39 | + # <phone>555-1234</phone> | |
40 | + # </person> | |
41 | + | |
42 | +== Compatibility | |
43 | + | |
44 | +=== Version 2.0.0 Compatibility Changes | |
45 | + | |
46 | +Version 2.0.0 introduces automatically escaped attribute values for | |
47 | +the first time. Versions prior to 2.0.0 did not insert escape | |
48 | +characters into attribute values in the XML markup. This allowed | |
49 | +attribute values to explicitly reference entities, which was | |
50 | +occasionally used by a small number of developers. Since strings | |
51 | +could always be explicitly escaped by hand, this was not a major | |
52 | +restriction in functionality. | |
53 | + | |
54 | +However, it did suprise most users of builder. Since the body text is | |
55 | +normally escaped, everybody expected the attribute values to be | |
56 | +escaped as well. Escaped attribute values were the number one support | |
57 | +request on the 1.x Builder series. | |
58 | + | |
59 | +Starting with Builder version 2.0.0, all attribute values expressed as | |
60 | +strings will be processed and the appropriate characters will be | |
61 | +escaped (e.g. "&" will be tranlated to "&"). Attribute values | |
62 | +that are expressed as Symbol values will not be processed for escaped | |
63 | +characters and will be unchanged in output. (Yes, this probably counts | |
64 | +as Symbol abuse, but the convention is convenient and flexible). | |
65 | + | |
66 | +Example: | |
67 | + | |
68 | + xml = Builder::XmlMarkup.new | |
69 | + xml.sample(:escaped=>"This&That", :unescaped=>:"Here&There") | |
70 | + xml.target! => | |
71 | + <sample escaped="This&That" unescaped="Here&There"/> | |
72 | + | |
73 | +=== Version 1.0.0 Compatibility Changes | |
74 | + | |
75 | +Version 1.0.0 introduces some changes that are not backwards | |
76 | +compatible with earlier releases of builder. The main areas of | |
77 | +incompatibility are: | |
78 | + | |
79 | +* Keyword based arguments to +new+ (rather than positional based). It | |
80 | + was found that a developer would often like to specify indentation | |
81 | + without providing an explicit target, or specify a target without | |
82 | + indentation. Keyword based arguments handle this situation nicely. | |
83 | + | |
84 | +* Builder must now be an explicit target for markup tags. Instead of | |
85 | + writing | |
86 | + | |
87 | + xml_markup = Builder::XmlMarkup.new | |
88 | + xml_markup.div { strong("text") } | |
89 | + | |
90 | + you need to write | |
91 | + | |
92 | + xml_markup = Builder::XmlMarkup.new | |
93 | + xml_markup.div { xml_markup.strong("text") } | |
94 | + | |
95 | +* The builder object is passed as a parameter to all nested markup | |
96 | + blocks. This allows you to create a short alias for the builder | |
97 | + object that can be used within the block. For example, the previous | |
98 | + example can be written as: | |
99 | + | |
100 | + xml_markup = Builder::XmlMarkup.new | |
101 | + xml_markup.div { |xml| xml.strong("text") } | |
102 | + | |
103 | +* If you have both a pre-1.0 and a post-1.0 gem of builder installed, | |
104 | + you can choose which version to use through the RubyGems | |
105 | + +require_gem+ facility. | |
106 | + | |
107 | + require_gem 'builder', "~> 0.0" # Gets the old version | |
108 | + require_gem 'builder', "~> 1.0" # Gets the new version | |
109 | + | |
110 | +== Features | |
111 | + | |
112 | +* XML Comments are supported ... | |
113 | + | |
114 | + xml_markup.comment! "This is a comment" | |
115 | + #=> <!-- This is a comment --> | |
116 | + | |
117 | +* XML processing instructions are supported ... | |
118 | + | |
119 | + xml_markup.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8" | |
120 | + #=> <?xml version="1.0" encoding="UTF-8"?> | |
121 | + | |
122 | + If the processing instruction is omitted, it defaults to "xml". | |
123 | + When the processing instruction is "xml", the defaults attributes | |
124 | + are: | |
125 | + | |
126 | + <b>version</b>:: 1.0 | |
127 | + <b>encoding</b>:: "UTF-8" | |
128 | + | |
129 | +* XML entity declarations are now supported to a small degree. | |
130 | + | |
131 | + xml_markup.declare! :DOCTYPE, :chapter, :SYSTEM, "../dtds/chapter.dtd" | |
132 | + #=> <!DOCTYPE chapter SYSTEM "../dtds/chapter.dtd"> | |
133 | + | |
134 | + The parameters to a declare! method must be either symbols or | |
135 | + strings. Symbols are inserted without quotes, and strings are | |
136 | + inserted with double quotes. Attribute-like arguments in hashes are | |
137 | + not allowed. | |
138 | + | |
139 | + If you need to have an argument to declare! be inserted without | |
140 | + quotes, but the arguement does not conform to the typical Ruby | |
141 | + syntax for symbols, then use the :"string" form to specify a symbol. | |
142 | + | |
143 | + For example: | |
144 | + | |
145 | + xml_markup.declare! :ELEMENT, :chapter, :"(title,para+)" | |
146 | + #=> <!ELEMENT chapter (title,para+)> | |
147 | + | |
148 | + Nested entity declarations are allowed. For example: | |
149 | + | |
150 | + @xml_markup.declare! :DOCTYPE, :chapter do |x| | |
151 | + x.declare! :ELEMENT, :chapter, :"(title,para+)" | |
152 | + x.declare! :ELEMENT, :title, :"(#PCDATA)" | |
153 | + x.declare! :ELEMENT, :para, :"(#PCDATA)" | |
154 | + end | |
155 | + | |
156 | + #=> | |
157 | + | |
158 | + <!DOCTYPE chapter [ | |
159 | + <!ELEMENT chapter (title,para+)> | |
160 | + <!ELEMENT title (#PCDATA)> | |
161 | + <!ELEMENT para (#PCDATA)> | |
162 | + ]> | |
163 | + | |
164 | +* Some support for XML namespaces is now available. If the first | |
165 | + argument to a tag call is a symbol, it will be joined to the tag to | |
166 | + produce a namespace:tag combination. It is easier to show this than | |
167 | + describe it. | |
168 | + | |
169 | + xml.SOAP :Envelope do ... end | |
170 | + | |
171 | + Just put a space before the colon in a namespace to produce the | |
172 | + right form for builder (e.g. "<tt>SOAP:Envelope</tt>" => | |
173 | + "<tt>xml.SOAP :Envelope</tt>") | |
174 | + | |
175 | +* String attribute values are <em>now</em> escaped by default by | |
176 | + Builder (<b>NOTE:</b> this is _new_ behavior as of version 2.0). | |
177 | + | |
178 | + However, occasionally you need to use entities in attribute values. | |
179 | + Using a symbols (rather than a string) for an attribute value will | |
180 | + cause Builder to not run its quoting/escaping algorithm on that | |
181 | + particular value. | |
182 | + | |
183 | + (<b>Note:</b> The +escape_attrs+ option for builder is now | |
184 | + obsolete). | |
185 | + | |
186 | + Example: | |
187 | + | |
188 | + xml = Builder::XmlMarkup.new | |
189 | + xml.sample(:escaped=>"This&That", :unescaped=>:"Here&There") | |
190 | + xml.target! => | |
191 | + <sample escaped="This&That" unescaped="Here&There"/> | |
192 | + | |
193 | +* UTF-8 Support | |
194 | + | |
195 | + Builder correctly translates UTF-8 characters into valid XML. (New | |
196 | + in version 2.0.0). Thanks to Sam Ruby for the translation code. | |
197 | + | |
198 | + Example: | |
199 | + | |
200 | + xml = Builder::Markup.new | |
201 | + xml.sample("Iñtërnâtiônàl") | |
202 | + xml.target! => | |
203 | + "<sample>Iñtërnâtiônàl</sample>" | |
204 | + | |
205 | +== Contact | |
206 | + | |
207 | +Author:: Jim Weirich | |
208 | +Email:: jim@weirichhouse.org | |
209 | +Home Page:: http://onestepback.org | |
210 | +License:: MIT Licence (http://www.opensource.org/licenses/mit-license.html) | ... | ... |
... | ... | @@ -0,0 +1,263 @@ |
1 | +# Rakefile for rake -*- ruby -*- | |
2 | + | |
3 | +# Copyright 2004, 2005, 2006 by Jim Weirich (jim@weirichhouse.org). | |
4 | +# All rights reserved. | |
5 | + | |
6 | +# Permission is granted for use, copying, modification, distribution, | |
7 | +# and distribution of modified versions of this work as long as the | |
8 | +# above copyright notice is included. | |
9 | + | |
10 | +require 'rake/clean' | |
11 | +require 'rake/testtask' | |
12 | +require 'rake/rdoctask' | |
13 | +begin | |
14 | + require 'rubygems' | |
15 | + require 'rake/gempackagetask' | |
16 | +rescue Exception | |
17 | + nil | |
18 | +end | |
19 | + | |
20 | +# Determine the current version of the software | |
21 | + | |
22 | +CLOBBER.include('pkg') | |
23 | + | |
24 | +CURRENT_VERSION = '2.1.2' | |
25 | +PKG_VERSION = ENV['REL'] ? ENV['REL'] : CURRENT_VERSION | |
26 | + | |
27 | +SRC_RB = FileList['lib/**/*.rb'] | |
28 | + | |
29 | +# The default task is run if rake is given no explicit arguments. | |
30 | + | |
31 | +desc "Default Task" | |
32 | +task :default => :test_all | |
33 | + | |
34 | +# Test Tasks --------------------------------------------------------- | |
35 | + | |
36 | +desc "Run all tests" | |
37 | +task :test_all => [:test_units] | |
38 | +task :ta => [:test_all] | |
39 | + | |
40 | +task :tu => [:test_units] | |
41 | + | |
42 | +Rake::TestTask.new("test_units") do |t| | |
43 | + t.test_files = FileList['test/test*.rb'] | |
44 | + t.verbose = false | |
45 | +end | |
46 | + | |
47 | +# Create a task to build the RDOC documentation tree. | |
48 | + | |
49 | +rd = Rake::RDocTask.new("rdoc") { |rdoc| | |
50 | + rdoc.rdoc_dir = 'html' | |
51 | + rdoc.title = "Builder for Markup" | |
52 | + rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README' | |
53 | + rdoc.rdoc_files.include('lib/**/*.rb', '[A-Z]*', 'doc/**/*.rdoc') | |
54 | + rdoc.template = 'doc/jamis.rb' | |
55 | +} | |
56 | + | |
57 | +# ==================================================================== | |
58 | +# Create a task that will package the Rake software into distributable | |
59 | +# gem files. | |
60 | + | |
61 | +PKG_FILES = FileList[ | |
62 | + 'lib/**/*.rb', | |
63 | + 'test/**/*.rb', | |
64 | + 'scripts/**/*.rb' | |
65 | +] | |
66 | +PKG_FILES.exclude('test/testcssbuilder.rb') | |
67 | +PKG_FILES.exclude('lib/builder/css.rb') | |
68 | + | |
69 | +BLANKSLATE_FILES = FileList[ | |
70 | + 'lib/blankslate.rb', | |
71 | + 'test/testblankslate.rb' | |
72 | +] | |
73 | + | |
74 | +if ! defined?(Gem) | |
75 | + puts "Package Target requires RubyGEMs" | |
76 | +else | |
77 | + spec = Gem::Specification.new do |s| | |
78 | + | |
79 | + #### Basic information. | |
80 | + | |
81 | + s.name = 'builder' | |
82 | + s.version = PKG_VERSION | |
83 | + s.summary = "Builders for MarkUp." | |
84 | + s.description = %{\ | |
85 | +Builder provides a number of builder objects that make creating structured data | |
86 | +simple to do. Currently the following builder objects are supported: | |
87 | + | |
88 | +* XML Markup | |
89 | +* XML Events | |
90 | +} | |
91 | + | |
92 | + s.files = PKG_FILES.to_a | |
93 | + s.require_path = 'lib' | |
94 | + s.autorequire = 'builder' | |
95 | + | |
96 | + s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ } | |
97 | + | |
98 | + s.has_rdoc = true | |
99 | + s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a | |
100 | + s.rdoc_options << | |
101 | + '--title' << 'Builder -- Easy XML Building' << | |
102 | + '--main' << 'README' << | |
103 | + '--line-numbers' | |
104 | + | |
105 | + s.author = "Jim Weirich" | |
106 | + s.email = "jim@weirichhouse.org" | |
107 | + s.homepage = "http://onestepback.org" | |
108 | + end | |
109 | + | |
110 | + blankslate_spec = Gem::Specification.new do |s| | |
111 | + | |
112 | + #### Basic information. | |
113 | + | |
114 | + s.name = 'blankslate' | |
115 | + s.version = PKG_VERSION | |
116 | + s.summary = "Blank Slate base class." | |
117 | + s.description = %{\ | |
118 | +BlankSlate provides a base class where almost all of the methods from Object and | |
119 | +Kernel have been removed. This is useful when providing proxy object and other | |
120 | +classes that make heavy use of method_missing. | |
121 | +} | |
122 | + | |
123 | + s.files = BLANKSLATE_FILES.to_a | |
124 | + s.require_path = 'lib' | |
125 | + s.autorequire = 'builder' | |
126 | + | |
127 | + s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ } | |
128 | + | |
129 | + s.has_rdoc = true | |
130 | + s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a | |
131 | + s.rdoc_options << | |
132 | + '--title' << 'BlankSlate -- Base Class for building proxies.' << | |
133 | + '--main' << 'README' << | |
134 | + '--line-numbers' | |
135 | + | |
136 | + s.author = "Jim Weirich" | |
137 | + s.email = "jim@weirichhouse.org" | |
138 | + s.homepage = "http://onestepback.org" | |
139 | + end | |
140 | + | |
141 | + namespace 'builder' do | |
142 | + Rake::GemPackageTask.new(spec) do |t| | |
143 | + t.need_tar = true | |
144 | + end | |
145 | + end | |
146 | + | |
147 | + namespace 'blankslate' do | |
148 | + Rake::GemPackageTask.new(blankslate_spec) do |t| | |
149 | + t.need_tar = true | |
150 | + end | |
151 | + end | |
152 | + | |
153 | + task :package => ['builder:package', 'blankslate:package'] | |
154 | +end | |
155 | + | |
156 | +desc "Look for Debugging print lines" | |
157 | +task :dbg do | |
158 | + FileList['**/*.rb'].egrep /\bDBG|\bbreakpoint\b/ | |
159 | +end | |
160 | + | |
161 | +# -------------------------------------------------------------------- | |
162 | +# Creating a release | |
163 | + | |
164 | +def announce(msg='') | |
165 | + STDERR.puts msg | |
166 | +end | |
167 | + | |
168 | +desc "Make a new release" | |
169 | +task :release => [ | |
170 | + :prerelease, | |
171 | + :clobber, | |
172 | + :test_all, | |
173 | + :update_version, | |
174 | + :package, | |
175 | + :tag] do | |
176 | + | |
177 | + announce | |
178 | + announce "**************************************************************" | |
179 | + announce "* Release #{PKG_VERSION} Complete." | |
180 | + announce "* Packages ready to upload." | |
181 | + announce "**************************************************************" | |
182 | + announce | |
183 | +end | |
184 | + | |
185 | +# Validate that everything is ready to go for a release. | |
186 | +task :prerelease do | |
187 | + announce | |
188 | + announce "**************************************************************" | |
189 | + announce "* Making RubyGem Release #{PKG_VERSION}" | |
190 | + announce "* (current version #{CURRENT_VERSION})" | |
191 | + announce "**************************************************************" | |
192 | + announce | |
193 | + | |
194 | + # Is a release number supplied? | |
195 | + unless ENV['REL'] | |
196 | + fail "Usage: rake release REL=x.y.z [REUSE=tag_suffix]" | |
197 | + end | |
198 | + | |
199 | + # Is the release different than the current release. | |
200 | + # (or is REUSE set?) | |
201 | + if PKG_VERSION == CURRENT_VERSION && ! ENV['REUSE'] | |
202 | + fail "Current version is #{PKG_VERSION}, must specify REUSE=tag_suffix to reuse version" | |
203 | + end | |
204 | + | |
205 | + # Are all source files checked in? | |
206 | + if ENV['RELTEST'] | |
207 | + announce "Release Task Testing, skipping checked-in file test" | |
208 | + else | |
209 | + announce "Checking for unchecked-in files..." | |
210 | + data = `cvs -q update` | |
211 | + unless data =~ /^$/ | |
212 | + fail "CVS update is not clean ... do you have unchecked-in files?" | |
213 | + end | |
214 | + announce "No outstanding checkins found ... OK" | |
215 | + end | |
216 | +end | |
217 | + | |
218 | +task :update_version => [:prerelease] do | |
219 | + if PKG_VERSION == CURRENT_VERSION | |
220 | + announce "No version change ... skipping version update" | |
221 | + else | |
222 | + announce "Updating Builder version to #{PKG_VERSION}" | |
223 | + open("Rakefile") do |rakein| | |
224 | + open("Rakefile.new", "w") do |rakeout| | |
225 | + rakein.each do |line| | |
226 | + if line =~ /^CURRENT_VERSION\s*=\s*/ | |
227 | + rakeout.puts "CURRENT_VERSION = '#{PKG_VERSION}'" | |
228 | + else | |
229 | + rakeout.puts line | |
230 | + end | |
231 | + end | |
232 | + end | |
233 | + end | |
234 | + mv "Rakefile.new", "Rakefile" | |
235 | + if ENV['RELTEST'] | |
236 | + announce "Release Task Testing, skipping commiting of new version" | |
237 | + else | |
238 | + sh %{cvs commit -m "Updated to version #{PKG_VERSION}" Rakefile} | |
239 | + end | |
240 | + end | |
241 | +end | |
242 | + | |
243 | +desc "Tag all the CVS files with the latest release number (REL=x.y.z)" | |
244 | +task :tag => [:prerelease] do | |
245 | + reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}" | |
246 | + reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE'] | |
247 | + announce "Tagging CVS with [#{reltag}]" | |
248 | + if ENV['RELTEST'] | |
249 | + announce "Release Task Testing, skipping CVS tagging" | |
250 | + else | |
251 | + sh %{cvs tag #{reltag}} | |
252 | + end | |
253 | +end | |
254 | + | |
255 | +desc "Install the jamis RDoc template" | |
256 | +task :install_jamis_template do | |
257 | + require 'rbconfig' | |
258 | + dest_dir = File.join(Config::CONFIG['rubylibdir'], "rdoc/generators/template/html") | |
259 | + fail "Unabled to write to #{dest_dir}" unless File.writable?(dest_dir) | |
260 | + install "doc/jamis.rb", dest_dir, :verbose => true | |
261 | +end | |
262 | + | |
263 | +require 'scripts/publish' | ... | ... |
vendor/gems/builder-2.1.2/doc/releases/builder-1.2.4.rdoc
0 → 100644
... | ... | @@ -0,0 +1,31 @@ |
1 | += Builder 1.2.4 Released. | |
2 | + | |
3 | +Added a "CDATA" method to the XML Markup builder (from Josh Knowles). | |
4 | + | |
5 | +== What is Builder? | |
6 | + | |
7 | +Builder::XmlMarkup allows easy programmatic creation of XML markup. | |
8 | +For example: | |
9 | + | |
10 | + builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2) | |
11 | + builder.person { |b| b.name("Jim"); b.phone("555-1234") } | |
12 | + puts builder.target! | |
13 | + | |
14 | +will generate: | |
15 | + | |
16 | + <person> | |
17 | + <name>Jim</name> | |
18 | + <phone>555-1234</phone> | |
19 | + </person> | |
20 | + | |
21 | +== Availability | |
22 | + | |
23 | +The easiest way to get and install builder is via RubyGems ... | |
24 | + | |
25 | + gem install builder (you may need root/admin privileges) | |
26 | + | |
27 | +== Thanks | |
28 | + | |
29 | +* Josh Knowles for the cdata! patch. | |
30 | + | |
31 | +-- Jim Weirich | ... | ... |
vendor/gems/builder-2.1.2/doc/releases/builder-2.0.0.rdoc
0 → 100644
... | ... | @@ -0,0 +1,46 @@ |
1 | += Builder 2.0.0 Released. | |
2 | + | |
3 | +== Changes in 2.0.0 | |
4 | + | |
5 | +* UTF-8 characters in data are now correctly translated to their XML | |
6 | + equivalents. (Thanks to Sam Ruby) | |
7 | + | |
8 | +* Attribute values are now escaped by default. See the README | |
9 | + file for details. | |
10 | + | |
11 | +<b>NOTE:</b> The escaping attribute values by default is different | |
12 | +than in previous releases of Builder. This makes version 2.0.0 | |
13 | +somewhat incompatible with the 1.x series of Builder. If you use "&", | |
14 | +"<", or ">" in attributes values, you may have to change your | |
15 | +code. (Essentially you remove the manual escaping. The new way is | |
16 | +easier, believe me). | |
17 | + | |
18 | +== What is Builder? | |
19 | + | |
20 | +Builder::XmlMarkup is a library that allows easy programmatic creation | |
21 | +of XML markup. For example: | |
22 | + | |
23 | + builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2) | |
24 | + builder.person { |b| b.name("Jim"); b.phone("555-1234") } | |
25 | + | |
26 | +will generate: | |
27 | + | |
28 | + <person> | |
29 | + <name>Jim</name> | |
30 | + <phone>555-1234</phone> | |
31 | + </person> | |
32 | + | |
33 | +== Availability | |
34 | + | |
35 | +The easiest way to get and install builder is via RubyGems ... | |
36 | + | |
37 | + gem install builder (you may need root/admin privileges) | |
38 | + | |
39 | +== Thanks | |
40 | + | |
41 | +* Sam Ruby for the XChar module and the related UTF-8 translation | |
42 | + tools. | |
43 | +* Also to Sam Ruby for gently persuading me to start quoting attribute | |
44 | + values. | |
45 | + | |
46 | +-- Jim Weirich | ... | ... |
vendor/gems/builder-2.1.2/doc/releases/builder-2.1.1.rdoc
0 → 100644
... | ... | @@ -0,0 +1,58 @@ |
1 | += Builder 2.1.1 Released. | |
2 | + | |
3 | +Release 2.1.1 of Builder is mainly a bug fix release. | |
4 | + | |
5 | +== Changes in 2.1.1 | |
6 | + | |
7 | +* Added <tt>reveal</tt> capability to BlankSlate. | |
8 | + | |
9 | +* Fixed a bug in BlankSlate where including a module into Object could | |
10 | + cause methods to leak into BlankSlate. | |
11 | + | |
12 | +* Fixed typo in XmlMarkup class docs (from Martin Fowler). | |
13 | + | |
14 | +* Fixed test on private methods to differentiate between targetted and | |
15 | + untargetted private methods. | |
16 | + | |
17 | +* Removed legacy capture of @self in XmlBase (@self was used back when | |
18 | + we used instance eval). | |
19 | + | |
20 | +* Added additional tests for global functions (both direct and | |
21 | + included). | |
22 | + | |
23 | +* Several misc internal cleanups, including rearranging the source | |
24 | + code tree. | |
25 | + | |
26 | +<b>NOTE:</b> The escaping attribute values by default is different | |
27 | +than in previous releases of Builder. This makes version 2.0.x | |
28 | +somewhat incompatible with the 1.x series of Builder. If you use "&", | |
29 | +"<", or ">" in attributes values, you may have to change your | |
30 | +code. (Essentially you remove the manual escaping. The new way is | |
31 | +easier, believe me). | |
32 | + | |
33 | +== What is Builder? | |
34 | + | |
35 | +Builder::XmlMarkup is a library that allows easy programmatic creation | |
36 | +of XML markup. For example: | |
37 | + | |
38 | + builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2) | |
39 | + builder.person { |b| b.name("Jim"); b.phone("555-1234") } | |
40 | + | |
41 | +will generate: | |
42 | + | |
43 | + <person> | |
44 | + <name>Jim</name> | |
45 | + <phone>555-1234</phone> | |
46 | + </person> | |
47 | + | |
48 | +== Availability | |
49 | + | |
50 | +The easiest way to get and install builder is via RubyGems ... | |
51 | + | |
52 | + gem install builder (you may need root/admin privileges) | |
53 | + | |
54 | +== Thanks | |
55 | + | |
56 | +* Martin Fowler for spotting some typos in the documentation. | |
57 | + | |
58 | +-- Jim Weirich | ... | ... |
... | ... | @@ -0,0 +1,113 @@ |
1 | +#!/usr/bin/env ruby | |
2 | +#-- | |
3 | +# Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org). | |
4 | +# All rights reserved. | |
5 | + | |
6 | +# Permission is granted for use, copying, modification, distribution, | |
7 | +# and distribution of modified versions of this work as long as the | |
8 | +# above copyright notice is included. | |
9 | +#++ | |
10 | + | |
11 | +###################################################################### | |
12 | +# BlankSlate provides an abstract base class with no predefined | |
13 | +# methods (except for <tt>\_\_send__</tt> and <tt>\_\_id__</tt>). | |
14 | +# BlankSlate is useful as a base class when writing classes that | |
15 | +# depend upon <tt>method_missing</tt> (e.g. dynamic proxies). | |
16 | +# | |
17 | +class BlankSlate | |
18 | + class << self | |
19 | + | |
20 | + # Hide the method named +name+ in the BlankSlate class. Don't | |
21 | + # hide +instance_eval+ or any method beginning with "__". | |
22 | + def hide(name) | |
23 | + if instance_methods.include?(name.to_s) and | |
24 | + name !~ /^(__|instance_eval)/ | |
25 | + @hidden_methods ||= {} | |
26 | + @hidden_methods[name.to_sym] = instance_method(name) | |
27 | + undef_method name | |
28 | + end | |
29 | + end | |
30 | + | |
31 | + def find_hidden_method(name) | |
32 | + @hidden_methods ||= {} | |
33 | + @hidden_methods[name] || superclass.find_hidden_method(name) | |
34 | + end | |
35 | + | |
36 | + # Redefine a previously hidden method so that it may be called on a blank | |
37 | + # slate object. | |
38 | + def reveal(name) | |
39 | + bound_method = nil | |
40 | + unbound_method = find_hidden_method(name) | |
41 | + fail "Don't know how to reveal method '#{name}'" unless unbound_method | |
42 | + define_method(name) do |*args| | |
43 | + bound_method ||= unbound_method.bind(self) | |
44 | + bound_method.call(*args) | |
45 | + end | |
46 | + end | |
47 | + end | |
48 | + | |
49 | + instance_methods.each { |m| hide(m) } | |
50 | +end | |
51 | + | |
52 | +###################################################################### | |
53 | +# Since Ruby is very dynamic, methods added to the ancestors of | |
54 | +# BlankSlate <em>after BlankSlate is defined</em> will show up in the | |
55 | +# list of available BlankSlate methods. We handle this by defining a | |
56 | +# hook in the Object and Kernel classes that will hide any method | |
57 | +# defined after BlankSlate has been loaded. | |
58 | +# | |
59 | +module Kernel | |
60 | + class << self | |
61 | + alias_method :blank_slate_method_added, :method_added | |
62 | + | |
63 | + # Detect method additions to Kernel and remove them in the | |
64 | + # BlankSlate class. | |
65 | + def method_added(name) | |
66 | + result = blank_slate_method_added(name) | |
67 | + return result if self != Kernel | |
68 | + BlankSlate.hide(name) | |
69 | + result | |
70 | + end | |
71 | + end | |
72 | +end | |
73 | + | |
74 | +###################################################################### | |
75 | +# Same as above, except in Object. | |
76 | +# | |
77 | +class Object | |
78 | + class << self | |
79 | + alias_method :blank_slate_method_added, :method_added | |
80 | + | |
81 | + # Detect method additions to Object and remove them in the | |
82 | + # BlankSlate class. | |
83 | + def method_added(name) | |
84 | + result = blank_slate_method_added(name) | |
85 | + return result if self != Object | |
86 | + BlankSlate.hide(name) | |
87 | + result | |
88 | + end | |
89 | + | |
90 | + def find_hidden_method(name) | |
91 | + nil | |
92 | + end | |
93 | + end | |
94 | +end | |
95 | + | |
96 | +###################################################################### | |
97 | +# Also, modules included into Object need to be scanned and have their | |
98 | +# instance methods removed from blank slate. In theory, modules | |
99 | +# included into Kernel would have to be removed as well, but a | |
100 | +# "feature" of Ruby prevents late includes into modules from being | |
101 | +# exposed in the first place. | |
102 | +# | |
103 | +class Module | |
104 | + alias blankslate_original_append_features append_features | |
105 | + def append_features(mod) | |
106 | + result = blankslate_original_append_features(mod) | |
107 | + return result if mod != Object | |
108 | + instance_methods.each do |name| | |
109 | + BlankSlate.hide(name) | |
110 | + end | |
111 | + result | |
112 | + end | |
113 | +end | |
0 | 114 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,13 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +#-- | |
4 | +# Copyright 2004 by Jim Weirich (jim@weirichhouse.org). | |
5 | +# All rights reserved. | |
6 | + | |
7 | +# Permission is granted for use, copying, modification, distribution, | |
8 | +# and distribution of modified versions of this work as long as the | |
9 | +# above copyright notice is included. | |
10 | +#++ | |
11 | + | |
12 | +require 'builder/xmlmarkup' | |
13 | +require 'builder/xmlevents' | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +#!/usr/bin/env ruby | |
2 | +#-- | |
3 | +# Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org). | |
4 | +# All rights reserved. | |
5 | + | |
6 | +# Permission is granted for use, copying, modification, distribution, | |
7 | +# and distribution of modified versions of this work as long as the | |
8 | +# above copyright notice is included. | |
9 | +#++ | |
10 | + | |
11 | +require 'blankslate' | |
12 | + | |
13 | +###################################################################### | |
14 | +# BlankSlate has been promoted to a top level name and is now | |
15 | +# available as a standalone gem. We make the name available in the | |
16 | +# Builder namespace for compatibility. | |
17 | +# | |
18 | +module Builder | |
19 | + BlankSlate = ::BlankSlate | |
20 | +end | ... | ... |
... | ... | @@ -0,0 +1,115 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +# The XChar library is provided courtesy of Sam Ruby (See | |
4 | +# http://intertwingly.net/stories/2005/09/28/xchar.rb) | |
5 | + | |
6 | +# -------------------------------------------------------------------- | |
7 | + | |
8 | +# If the Builder::XChar module is not currently defined, fail on any | |
9 | +# name clashes in standard library classes. | |
10 | + | |
11 | +module Builder | |
12 | + def self.check_for_name_collision(klass, method_name, defined_constant=nil) | |
13 | + if klass.instance_methods.include?(method_name) | |
14 | + fail RuntimeError, | |
15 | + "Name Collision: Method '#{method_name}' is already defined in #{klass}" | |
16 | + end | |
17 | + end | |
18 | +end | |
19 | + | |
20 | +if ! defined?(Builder::XChar) | |
21 | + Builder.check_for_name_collision(String, "to_xs") | |
22 | + Builder.check_for_name_collision(Fixnum, "xchr") | |
23 | +end | |
24 | + | |
25 | +###################################################################### | |
26 | +module Builder | |
27 | + | |
28 | + #################################################################### | |
29 | + # XML Character converter, from Sam Ruby: | |
30 | + # (see http://intertwingly.net/stories/2005/09/28/xchar.rb). | |
31 | + # | |
32 | + module XChar # :nodoc: | |
33 | + | |
34 | + # See | |
35 | + # http://intertwingly.net/stories/2004/04/14/i18n.html#CleaningWindows | |
36 | + # for details. | |
37 | + CP1252 = { # :nodoc: | |
38 | + 128 => 8364, # euro sign | |
39 | + 130 => 8218, # single low-9 quotation mark | |
40 | + 131 => 402, # latin small letter f with hook | |
41 | + 132 => 8222, # double low-9 quotation mark | |
42 | + 133 => 8230, # horizontal ellipsis | |
43 | + 134 => 8224, # dagger | |
44 | + 135 => 8225, # double dagger | |
45 | + 136 => 710, # modifier letter circumflex accent | |
46 | + 137 => 8240, # per mille sign | |
47 | + 138 => 352, # latin capital letter s with caron | |
48 | + 139 => 8249, # single left-pointing angle quotation mark | |
49 | + 140 => 338, # latin capital ligature oe | |
50 | + 142 => 381, # latin capital letter z with caron | |
51 | + 145 => 8216, # left single quotation mark | |
52 | + 146 => 8217, # right single quotation mark | |
53 | + 147 => 8220, # left double quotation mark | |
54 | + 148 => 8221, # right double quotation mark | |
55 | + 149 => 8226, # bullet | |
56 | + 150 => 8211, # en dash | |
57 | + 151 => 8212, # em dash | |
58 | + 152 => 732, # small tilde | |
59 | + 153 => 8482, # trade mark sign | |
60 | + 154 => 353, # latin small letter s with caron | |
61 | + 155 => 8250, # single right-pointing angle quotation mark | |
62 | + 156 => 339, # latin small ligature oe | |
63 | + 158 => 382, # latin small letter z with caron | |
64 | + 159 => 376, # latin capital letter y with diaeresis | |
65 | + } | |
66 | + | |
67 | + # See http://www.w3.org/TR/REC-xml/#dt-chardata for details. | |
68 | + PREDEFINED = { | |
69 | + 38 => '&', # ampersand | |
70 | + 60 => '<', # left angle bracket | |
71 | + 62 => '>', # right angle bracket | |
72 | + } | |
73 | + | |
74 | + # See http://www.w3.org/TR/REC-xml/#charsets for details. | |
75 | + VALID = [ | |
76 | + 0x9, 0xA, 0xD, | |
77 | + (0x20..0xD7FF), | |
78 | + (0xE000..0xFFFD), | |
79 | + (0x10000..0x10FFFF) | |
80 | + ] | |
81 | + end | |
82 | + | |
83 | +end | |
84 | + | |
85 | + | |
86 | +###################################################################### | |
87 | +# Enhance the Fixnum class with a XML escaped character conversion. | |
88 | +# | |
89 | +class Fixnum | |
90 | + XChar = Builder::XChar if ! defined?(XChar) | |
91 | + | |
92 | + # XML escaped version of chr | |
93 | + def xchr | |
94 | + n = XChar::CP1252[self] || self | |
95 | + case n when *XChar::VALID | |
96 | + XChar::PREDEFINED[n] or (n<128 ? n.chr : "&##{n};") | |
97 | + else | |
98 | + '*' | |
99 | + end | |
100 | + end | |
101 | +end | |
102 | + | |
103 | + | |
104 | +###################################################################### | |
105 | +# Enhance the String class with a XML escaped character version of | |
106 | +# to_s. | |
107 | +# | |
108 | +class String | |
109 | + # XML escaped version of to_s | |
110 | + def to_xs | |
111 | + unpack('U*').map {|n| n.xchr}.join # ASCII, UTF-8 | |
112 | + rescue | |
113 | + unpack('C*').map {|n| n.xchr}.join # ISO-8859-1, WIN-1252 | |
114 | + end | |
115 | +end | ... | ... |
... | ... | @@ -0,0 +1,139 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +require 'builder/blankslate' | |
4 | + | |
5 | +module Builder | |
6 | + | |
7 | + # Generic error for builder | |
8 | + class IllegalBlockError < RuntimeError; end | |
9 | + | |
10 | + # XmlBase is a base class for building XML builders. See | |
11 | + # Builder::XmlMarkup and Builder::XmlEvents for examples. | |
12 | + class XmlBase < BlankSlate | |
13 | + | |
14 | + # Create an XML markup builder. | |
15 | + # | |
16 | + # out:: Object receiving the markup. +out+ must respond to | |
17 | + # <tt><<</tt>. | |
18 | + # indent:: Number of spaces used for indentation (0 implies no | |
19 | + # indentation and no line breaks). | |
20 | + # initial:: Level of initial indentation. | |
21 | + # | |
22 | + def initialize(indent=0, initial=0) | |
23 | + @indent = indent | |
24 | + @level = initial | |
25 | + end | |
26 | + | |
27 | + # Create a tag named +sym+. Other than the first argument which | |
28 | + # is the tag name, the arguements are the same as the tags | |
29 | + # implemented via <tt>method_missing</tt>. | |
30 | + def tag!(sym, *args, &block) | |
31 | + method_missing(sym.to_sym, *args, &block) | |
32 | + end | |
33 | + | |
34 | + # Create XML markup based on the name of the method. This method | |
35 | + # is never invoked directly, but is called for each markup method | |
36 | + # in the markup block. | |
37 | + def method_missing(sym, *args, &block) | |
38 | + text = nil | |
39 | + attrs = nil | |
40 | + sym = "#{sym}:#{args.shift}" if args.first.kind_of?(Symbol) | |
41 | + args.each do |arg| | |
42 | + case arg | |
43 | + when Hash | |
44 | + attrs ||= {} | |
45 | + attrs.merge!(arg) | |
46 | + else | |
47 | + text ||= '' | |
48 | + text << arg.to_s | |
49 | + end | |
50 | + end | |
51 | + if block | |
52 | + unless text.nil? | |
53 | + raise ArgumentError, "XmlMarkup cannot mix a text argument with a block" | |
54 | + end | |
55 | + _indent | |
56 | + _start_tag(sym, attrs) | |
57 | + _newline | |
58 | + _nested_structures(block) | |
59 | + _indent | |
60 | + _end_tag(sym) | |
61 | + _newline | |
62 | + elsif text.nil? | |
63 | + _indent | |
64 | + _start_tag(sym, attrs, true) | |
65 | + _newline | |
66 | + else | |
67 | + _indent | |
68 | + _start_tag(sym, attrs) | |
69 | + text! text | |
70 | + _end_tag(sym) | |
71 | + _newline | |
72 | + end | |
73 | + @target | |
74 | + end | |
75 | + | |
76 | + # Append text to the output target. Escape any markup. May be | |
77 | + # used within the markup brakets as: | |
78 | + # | |
79 | + # builder.p { |b| b.br; b.text! "HI" } #=> <p><br/>HI</p> | |
80 | + def text!(text) | |
81 | + _text(_escape(text)) | |
82 | + end | |
83 | + | |
84 | + # Append text to the output target without escaping any markup. | |
85 | + # May be used within the markup brakets as: | |
86 | + # | |
87 | + # builder.p { |x| x << "<br/>HI" } #=> <p><br/>HI</p> | |
88 | + # | |
89 | + # This is useful when using non-builder enabled software that | |
90 | + # generates strings. Just insert the string directly into the | |
91 | + # builder without changing the inserted markup. | |
92 | + # | |
93 | + # It is also useful for stacking builder objects. Builders only | |
94 | + # use <tt><<</tt> to append to the target, so by supporting this | |
95 | + # method/operation builders can use other builders as their | |
96 | + # targets. | |
97 | + def <<(text) | |
98 | + _text(text) | |
99 | + end | |
100 | + | |
101 | + # For some reason, nil? is sent to the XmlMarkup object. If nil? | |
102 | + # is not defined and method_missing is invoked, some strange kind | |
103 | + # of recursion happens. Since nil? won't ever be an XML tag, it | |
104 | + # is pretty safe to define it here. (Note: this is an example of | |
105 | + # cargo cult programming, | |
106 | + # cf. http://fishbowl.pastiche.org/2004/10/13/cargo_cult_programming). | |
107 | + def nil? | |
108 | + false | |
109 | + end | |
110 | + | |
111 | + private | |
112 | + | |
113 | + require 'builder/xchar' | |
114 | + def _escape(text) | |
115 | + text.to_xs | |
116 | + end | |
117 | + | |
118 | + def _escape_quote(text) | |
119 | + _escape(text).gsub(%r{"}, '"') # " WART | |
120 | + end | |
121 | + | |
122 | + def _newline | |
123 | + return if @indent == 0 | |
124 | + text! "\n" | |
125 | + end | |
126 | + | |
127 | + def _indent | |
128 | + return if @indent == 0 || @level == 0 | |
129 | + text!(" " * (@level * @indent)) | |
130 | + end | |
131 | + | |
132 | + def _nested_structures(block) | |
133 | + @level += 1 | |
134 | + block.call(self) | |
135 | + ensure | |
136 | + @level -= 1 | |
137 | + end | |
138 | + end | |
139 | +end | ... | ... |
... | ... | @@ -0,0 +1,63 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +#-- | |
4 | +# Copyright 2004 by Jim Weirich (jim@weirichhouse.org). | |
5 | +# All rights reserved. | |
6 | + | |
7 | +# Permission is granted for use, copying, modification, distribution, | |
8 | +# and distribution of modified versions of this work as long as the | |
9 | +# above copyright notice is included. | |
10 | +#++ | |
11 | + | |
12 | +require 'builder/xmlmarkup' | |
13 | + | |
14 | +module Builder | |
15 | + | |
16 | + # Create a series of SAX-like XML events (e.g. start_tag, end_tag) | |
17 | + # from the markup code. XmlEvent objects are used in a way similar | |
18 | + # to XmlMarkup objects, except that a series of events are generated | |
19 | + # and passed to a handler rather than generating character-based | |
20 | + # markup. | |
21 | + # | |
22 | + # Usage: | |
23 | + # xe = Builder::XmlEvents.new(hander) | |
24 | + # xe.title("HI") # Sends start_tag/end_tag/text messages to the handler. | |
25 | + # | |
26 | + # Indentation may also be selected by providing value for the | |
27 | + # indentation size and initial indentation level. | |
28 | + # | |
29 | + # xe = Builder::XmlEvents.new(handler, indent_size, initial_indent_level) | |
30 | + # | |
31 | + # == XML Event Handler | |
32 | + # | |
33 | + # The handler object must expect the following events. | |
34 | + # | |
35 | + # [<tt>start_tag(tag, attrs)</tt>] | |
36 | + # Announces that a new tag has been found. +tag+ is the name of | |
37 | + # the tag and +attrs+ is a hash of attributes for the tag. | |
38 | + # | |
39 | + # [<tt>end_tag(tag)</tt>] | |
40 | + # Announces that an end tag for +tag+ has been found. | |
41 | + # | |
42 | + # [<tt>text(text)</tt>] | |
43 | + # Announces that a string of characters (+text+) has been found. | |
44 | + # A series of characters may be broken up into more than one | |
45 | + # +text+ call, so the client cannot assume that a single | |
46 | + # callback contains all the text data. | |
47 | + # | |
48 | + class XmlEvents < XmlMarkup | |
49 | + def text!(text) | |
50 | + @target.text(text) | |
51 | + end | |
52 | + | |
53 | + def _start_tag(sym, attrs, end_too=false) | |
54 | + @target.start_tag(sym, attrs) | |
55 | + _end_tag(sym) if end_too | |
56 | + end | |
57 | + | |
58 | + def _end_tag(sym) | |
59 | + @target.end_tag(sym) | |
60 | + end | |
61 | + end | |
62 | + | |
63 | +end | ... | ... |
... | ... | @@ -0,0 +1,328 @@ |
1 | +#!/usr/bin/env ruby | |
2 | +#-- | |
3 | +# Copyright 2004, 2005 by Jim Weirich (jim@weirichhouse.org). | |
4 | +# All rights reserved. | |
5 | + | |
6 | +# Permission is granted for use, copying, modification, distribution, | |
7 | +# and distribution of modified versions of this work as long as the | |
8 | +# above copyright notice is included. | |
9 | +#++ | |
10 | + | |
11 | +# Provide a flexible and easy to use Builder for creating XML markup. | |
12 | +# See XmlBuilder for usage details. | |
13 | + | |
14 | +require 'builder/xmlbase' | |
15 | + | |
16 | +module Builder | |
17 | + | |
18 | + # Create XML markup easily. All (well, almost all) methods sent to | |
19 | + # an XmlMarkup object will be translated to the equivalent XML | |
20 | + # markup. Any method with a block will be treated as an XML markup | |
21 | + # tag with nested markup in the block. | |
22 | + # | |
23 | + # Examples will demonstrate this easier than words. In the | |
24 | + # following, +xm+ is an +XmlMarkup+ object. | |
25 | + # | |
26 | + # xm.em("emphasized") # => <em>emphasized</em> | |
27 | + # xm.em { xmm.b("emp & bold") } # => <em><b>emph & bold</b></em> | |
28 | + # xm.a("A Link", "href"=>"http://onestepback.org") | |
29 | + # # => <a href="http://onestepback.org">A Link</a> | |
30 | + # xm.div { br } # => <div><br/></div> | |
31 | + # xm.target("name"=>"compile", "option"=>"fast") | |
32 | + # # => <target option="fast" name="compile"\> | |
33 | + # # NOTE: order of attributes is not specified. | |
34 | + # | |
35 | + # xm.instruct! # <?xml version="1.0" encoding="UTF-8"?> | |
36 | + # xm.html { # <html> | |
37 | + # xm.head { # <head> | |
38 | + # xm.title("History") # <title>History</title> | |
39 | + # } # </head> | |
40 | + # xm.body { # <body> | |
41 | + # xm.comment! "HI" # <!-- HI --> | |
42 | + # xm.h1("Header") # <h1>Header</h1> | |
43 | + # xm.p("paragraph") # <p>paragraph</p> | |
44 | + # } # </body> | |
45 | + # } # </html> | |
46 | + # | |
47 | + # == Notes: | |
48 | + # | |
49 | + # * The order that attributes are inserted in markup tags is | |
50 | + # undefined. | |
51 | + # | |
52 | + # * Sometimes you wish to insert text without enclosing tags. Use | |
53 | + # the <tt>text!</tt> method to accomplish this. | |
54 | + # | |
55 | + # Example: | |
56 | + # | |
57 | + # xm.div { # <div> | |
58 | + # xm.text! "line"; xm.br # line<br/> | |
59 | + # xm.text! "another line"; xmbr # another line<br/> | |
60 | + # } # </div> | |
61 | + # | |
62 | + # * The special XML characters <, >, and & are converted to <, | |
63 | + # > and & automatically. Use the <tt><<</tt> operation to | |
64 | + # insert text without modification. | |
65 | + # | |
66 | + # * Sometimes tags use special characters not allowed in ruby | |
67 | + # identifiers. Use the <tt>tag!</tt> method to handle these | |
68 | + # cases. | |
69 | + # | |
70 | + # Example: | |
71 | + # | |
72 | + # xml.tag!("SOAP:Envelope") { ... } | |
73 | + # | |
74 | + # will produce ... | |
75 | + # | |
76 | + # <SOAP:Envelope> ... </SOAP:Envelope>" | |
77 | + # | |
78 | + # <tt>tag!</tt> will also take text and attribute arguments (after | |
79 | + # the tag name) like normal markup methods. (But see the next | |
80 | + # bullet item for a better way to handle XML namespaces). | |
81 | + # | |
82 | + # * Direct support for XML namespaces is now available. If the | |
83 | + # first argument to a tag call is a symbol, it will be joined to | |
84 | + # the tag to produce a namespace:tag combination. It is easier to | |
85 | + # show this than describe it. | |
86 | + # | |
87 | + # xml.SOAP :Envelope do ... end | |
88 | + # | |
89 | + # Just put a space before the colon in a namespace to produce the | |
90 | + # right form for builder (e.g. "<tt>SOAP:Envelope</tt>" => | |
91 | + # "<tt>xml.SOAP :Envelope</tt>") | |
92 | + # | |
93 | + # * XmlMarkup builds the markup in any object (called a _target_) | |
94 | + # that accepts the <tt><<</tt> method. If no target is given, | |
95 | + # then XmlMarkup defaults to a string target. | |
96 | + # | |
97 | + # Examples: | |
98 | + # | |
99 | + # xm = Builder::XmlMarkup.new | |
100 | + # result = xm.title("yada") | |
101 | + # # result is a string containing the markup. | |
102 | + # | |
103 | + # buffer = "" | |
104 | + # xm = Builder::XmlMarkup.new(buffer) | |
105 | + # # The markup is appended to buffer (using <<) | |
106 | + # | |
107 | + # xm = Builder::XmlMarkup.new(STDOUT) | |
108 | + # # The markup is written to STDOUT (using <<) | |
109 | + # | |
110 | + # xm = Builder::XmlMarkup.new | |
111 | + # x2 = Builder::XmlMarkup.new(:target=>xm) | |
112 | + # # Markup written to +x2+ will be send to +xm+. | |
113 | + # | |
114 | + # * Indentation is enabled by providing the number of spaces to | |
115 | + # indent for each level as a second argument to XmlBuilder.new. | |
116 | + # Initial indentation may be specified using a third parameter. | |
117 | + # | |
118 | + # Example: | |
119 | + # | |
120 | + # xm = Builder.new(:indent=>2) | |
121 | + # # xm will produce nicely formatted and indented XML. | |
122 | + # | |
123 | + # xm = Builder.new(:indent=>2, :margin=>4) | |
124 | + # # xm will produce nicely formatted and indented XML with 2 | |
125 | + # # spaces per indent and an over all indentation level of 4. | |
126 | + # | |
127 | + # builder = Builder::XmlMarkup.new(:target=>$stdout, :indent=>2) | |
128 | + # builder.name { |b| b.first("Jim"); b.last("Weirich) } | |
129 | + # # prints: | |
130 | + # # <name> | |
131 | + # # <first>Jim</first> | |
132 | + # # <last>Weirich</last> | |
133 | + # # </name> | |
134 | + # | |
135 | + # * The instance_eval implementation which forces self to refer to | |
136 | + # the message receiver as self is now obsolete. We now use normal | |
137 | + # block calls to execute the markup block. This means that all | |
138 | + # markup methods must now be explicitly send to the xml builder. | |
139 | + # For instance, instead of | |
140 | + # | |
141 | + # xml.div { strong("text") } | |
142 | + # | |
143 | + # you need to write: | |
144 | + # | |
145 | + # xml.div { xml.strong("text") } | |
146 | + # | |
147 | + # Although more verbose, the subtle change in semantics within the | |
148 | + # block was found to be prone to error. To make this change a | |
149 | + # little less cumbersome, the markup block now gets the markup | |
150 | + # object sent as an argument, allowing you to use a shorter alias | |
151 | + # within the block. | |
152 | + # | |
153 | + # For example: | |
154 | + # | |
155 | + # xml_builder = Builder::XmlMarkup.new | |
156 | + # xml_builder.div { |xml| | |
157 | + # xml.stong("text") | |
158 | + # } | |
159 | + # | |
160 | + class XmlMarkup < XmlBase | |
161 | + | |
162 | + # Create an XML markup builder. Parameters are specified by an | |
163 | + # option hash. | |
164 | + # | |
165 | + # :target=><em>target_object</em>:: | |
166 | + # Object receiving the markup. +out+ must respond to the | |
167 | + # <tt><<</tt> operator. The default is a plain string target. | |
168 | + # | |
169 | + # :indent=><em>indentation</em>:: | |
170 | + # Number of spaces used for indentation. The default is no | |
171 | + # indentation and no line breaks. | |
172 | + # | |
173 | + # :margin=><em>initial_indentation_level</em>:: | |
174 | + # Amount of initial indentation (specified in levels, not | |
175 | + # spaces). | |
176 | + # | |
177 | + # :escape_attrs=><b>OBSOLETE</em>:: | |
178 | + # The :escape_attrs option is no longer supported by builder | |
179 | + # (and will be quietly ignored). String attribute values are | |
180 | + # now automatically escaped. If you need unescaped attribute | |
181 | + # values (perhaps you are using entities in the attribute | |
182 | + # values), then give the value as a Symbol. This allows much | |
183 | + # finer control over escaping attribute values. | |
184 | + # | |
185 | + def initialize(options={}) | |
186 | + indent = options[:indent] || 0 | |
187 | + margin = options[:margin] || 0 | |
188 | + super(indent, margin) | |
189 | + @target = options[:target] || "" | |
190 | + end | |
191 | + | |
192 | + # Return the target of the builder. | |
193 | + def target! | |
194 | + @target | |
195 | + end | |
196 | + | |
197 | + def comment!(comment_text) | |
198 | + _ensure_no_block block_given? | |
199 | + _special("<!-- ", " -->", comment_text, nil) | |
200 | + end | |
201 | + | |
202 | + # Insert an XML declaration into the XML markup. | |
203 | + # | |
204 | + # For example: | |
205 | + # | |
206 | + # xml.declare! :ELEMENT, :blah, "yada" | |
207 | + # # => <!ELEMENT blah "yada"> | |
208 | + def declare!(inst, *args, &block) | |
209 | + _indent | |
210 | + @target << "<!#{inst}" | |
211 | + args.each do |arg| | |
212 | + case arg | |
213 | + when String | |
214 | + @target << %{ "#{arg}"} # " WART | |
215 | + when Symbol | |
216 | + @target << " #{arg}" | |
217 | + end | |
218 | + end | |
219 | + if block_given? | |
220 | + @target << " [" | |
221 | + _newline | |
222 | + _nested_structures(block) | |
223 | + @target << "]" | |
224 | + end | |
225 | + @target << ">" | |
226 | + _newline | |
227 | + end | |
228 | + | |
229 | + # Insert a processing instruction into the XML markup. E.g. | |
230 | + # | |
231 | + # For example: | |
232 | + # | |
233 | + # xml.instruct! | |
234 | + # #=> <?xml version="1.0" encoding="UTF-8"?> | |
235 | + # xml.instruct! :aaa, :bbb=>"ccc" | |
236 | + # #=> <?aaa bbb="ccc"?> | |
237 | + # | |
238 | + def instruct!(directive_tag=:xml, attrs={}) | |
239 | + _ensure_no_block block_given? | |
240 | + if directive_tag == :xml | |
241 | + a = { :version=>"1.0", :encoding=>"UTF-8" } | |
242 | + attrs = a.merge attrs | |
243 | + end | |
244 | + _special( | |
245 | + "<?#{directive_tag}", | |
246 | + "?>", | |
247 | + nil, | |
248 | + attrs, | |
249 | + [:version, :encoding, :standalone]) | |
250 | + end | |
251 | + | |
252 | + # Insert a CDATA section into the XML markup. | |
253 | + # | |
254 | + # For example: | |
255 | + # | |
256 | + # xml.cdata!("text to be included in cdata") | |
257 | + # #=> <![CDATA[text to be included in cdata]]> | |
258 | + # | |
259 | + def cdata!(text) | |
260 | + _ensure_no_block block_given? | |
261 | + _special("<![CDATA[", "]]>", text, nil) | |
262 | + end | |
263 | + | |
264 | + private | |
265 | + | |
266 | + # NOTE: All private methods of a builder object are prefixed when | |
267 | + # a "_" character to avoid possible conflict with XML tag names. | |
268 | + | |
269 | + # Insert text directly in to the builder's target. | |
270 | + def _text(text) | |
271 | + @target << text | |
272 | + end | |
273 | + | |
274 | + # Insert special instruction. | |
275 | + def _special(open, close, data=nil, attrs=nil, order=[]) | |
276 | + _indent | |
277 | + @target << open | |
278 | + @target << data if data | |
279 | + _insert_attributes(attrs, order) if attrs | |
280 | + @target << close | |
281 | + _newline | |
282 | + end | |
283 | + | |
284 | + # Start an XML tag. If <tt>end_too</tt> is true, then the start | |
285 | + # tag is also the end tag (e.g. <br/> | |
286 | + def _start_tag(sym, attrs, end_too=false) | |
287 | + @target << "<#{sym}" | |
288 | + _insert_attributes(attrs) | |
289 | + @target << "/" if end_too | |
290 | + @target << ">" | |
291 | + end | |
292 | + | |
293 | + # Insert an ending tag. | |
294 | + def _end_tag(sym) | |
295 | + @target << "</#{sym}>" | |
296 | + end | |
297 | + | |
298 | + # Insert the attributes (given in the hash). | |
299 | + def _insert_attributes(attrs, order=[]) | |
300 | + return if attrs.nil? | |
301 | + order.each do |k| | |
302 | + v = attrs[k] | |
303 | + @target << %{ #{k}="#{_attr_value(v)}"} if v # " WART | |
304 | + end | |
305 | + attrs.each do |k, v| | |
306 | + @target << %{ #{k}="#{_attr_value(v)}"} unless order.member?(k) # " WART | |
307 | + end | |
308 | + end | |
309 | + | |
310 | + def _attr_value(value) | |
311 | + case value | |
312 | + when Symbol | |
313 | + value.to_s | |
314 | + else | |
315 | + _escape_quote(value.to_s) | |
316 | + end | |
317 | + end | |
318 | + | |
319 | + def _ensure_no_block(got_block) | |
320 | + if got_block | |
321 | + fail IllegalBlockError, | |
322 | + "Blocks are not allowed on XML instructions" | |
323 | + end | |
324 | + end | |
325 | + | |
326 | + end | |
327 | + | |
328 | +end | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +# Optional publish task for Rake | |
2 | + | |
3 | +require 'rake/contrib/sshpublisher' | |
4 | +require 'rake/contrib/rubyforgepublisher' | |
5 | + | |
6 | +publisher = Rake::CompositePublisher.new | |
7 | +publisher.add Rake::RubyForgePublisher.new('builder', 'jimweirich') | |
8 | +publisher.add Rake::SshFilePublisher.new( | |
9 | + 'umlcoop', | |
10 | + 'htdocs/software/builder', | |
11 | + '.', | |
12 | + 'builder.blurb') | |
13 | + | |
14 | +desc "Publish the Documentation to RubyForge." | |
15 | +task :publish => [:rdoc] do | |
16 | + publisher.upload | |
17 | +end | ... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +require 'builder/xmlmarkup' | |
4 | +require 'benchmark' | |
5 | + | |
6 | +text = "This is a test of the new xml markup. Iñtërnâtiônàlizætiøn\n" * 10000 | |
7 | + | |
8 | +include Benchmark # we need the CAPTION and FMTSTR constants | |
9 | +include Builder | |
10 | +n = 50 | |
11 | +Benchmark.benchmark do |bm| | |
12 | + tf = bm.report("base") { | |
13 | + n.times do | |
14 | + x = XmlMarkup.new | |
15 | + x.text(text) | |
16 | + x.target! | |
17 | + end | |
18 | + } | |
19 | + def XmlMarkup._escape(text) | |
20 | + text.to_xs | |
21 | + end | |
22 | + tf = bm.report("to_xs") { | |
23 | + n.times do | |
24 | + x = XmlMarkup.new | |
25 | + x.text(text) | |
26 | + x.target! | |
27 | + end | |
28 | + } | |
29 | +end | |
30 | + | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +# We are defining method_added in Kernel and Object so that when | |
4 | +# BlankSlate overrides them later, we can verify that it correctly | |
5 | +# calls the older hooks. | |
6 | + | |
7 | +module Kernel | |
8 | + class << self | |
9 | + attr_reader :k_added_names | |
10 | + alias_method :preload_method_added, :method_added | |
11 | + def method_added(name) | |
12 | + preload_method_added(name) | |
13 | + @k_added_names ||= [] | |
14 | + @k_added_names << name | |
15 | + end | |
16 | + end | |
17 | +end | |
18 | + | |
19 | +class Object | |
20 | + class << self | |
21 | + attr_reader :o_added_names | |
22 | + alias_method :preload_method_added, :method_added | |
23 | + def method_added(name) | |
24 | + preload_method_added(name) | |
25 | + @o_added_names ||= [] | |
26 | + @o_added_names << name | |
27 | + end | |
28 | + end | |
29 | +end | ... | ... |
... | ... | @@ -0,0 +1,37 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +require 'test/unit' | |
4 | +require 'builder/xchar' | |
5 | + | |
6 | +class TestXmlEscaping < Test::Unit::TestCase | |
7 | + def test_ascii | |
8 | + assert_equal 'abc', 'abc'.to_xs | |
9 | + end | |
10 | + | |
11 | + def test_predefined | |
12 | + assert_equal '&', '&'.to_xs # ampersand | |
13 | + assert_equal '<', '<'.to_xs # left angle bracket | |
14 | + assert_equal '>', '>'.to_xs # right angle bracket | |
15 | + end | |
16 | + | |
17 | + def test_invalid | |
18 | + assert_equal '*', "\x00".to_xs # null | |
19 | + assert_equal '*', "\x0C".to_xs # form feed | |
20 | + assert_equal '*', "\xEF\xBF\xBF".to_xs # U+FFFF | |
21 | + end | |
22 | + | |
23 | + def test_iso_8859_1 | |
24 | + assert_equal 'ç', "\xE7".to_xs # small c cedilla | |
25 | + assert_equal '©', "\xA9".to_xs # copyright symbol | |
26 | + end | |
27 | + | |
28 | + def test_win_1252 | |
29 | + assert_equal '’', "\x92".to_xs # smart quote | |
30 | + assert_equal '€', "\x80".to_xs # euro | |
31 | + end | |
32 | + | |
33 | + def test_utf8 | |
34 | + assert_equal '’', "\xE2\x80\x99".to_xs # right single quote | |
35 | + assert_equal '©', "\xC2\xA9".to_xs # copy | |
36 | + end | |
37 | +end | ... | ... |
... | ... | @@ -0,0 +1,183 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +require 'test/unit' | |
4 | +require 'test/preload' | |
5 | +require 'builder/blankslate' | |
6 | +require 'stringio' | |
7 | + | |
8 | +# Methods to be introduced into the Object class late. | |
9 | +module LateObject | |
10 | + def late_object | |
11 | + 33 | |
12 | + end | |
13 | + def LateObject.included(mod) | |
14 | + # Modules defining an included method should not prevent blank | |
15 | + # slate erasure! | |
16 | + end | |
17 | +end | |
18 | + | |
19 | +# Methods to be introduced into the Kernel module late. | |
20 | +module LateKernel | |
21 | + def late_kernel | |
22 | + 44 | |
23 | + end | |
24 | + def LateKernel.included(mod) | |
25 | + # Modules defining an included method should not prevent blank | |
26 | + # slate erasure! | |
27 | + end | |
28 | +end | |
29 | + | |
30 | +# Introduce some late methods (both module and direct) into the Kernel | |
31 | +# module. | |
32 | +module Kernel | |
33 | + include LateKernel | |
34 | + | |
35 | + def late_addition | |
36 | + 1234 | |
37 | + end | |
38 | + | |
39 | + def double_late_addition | |
40 | + 11 | |
41 | + end | |
42 | + | |
43 | + def double_late_addition | |
44 | + 22 | |
45 | + end | |
46 | +end | |
47 | + | |
48 | + | |
49 | +# Introduce some late methods (both module and direct) into the Object | |
50 | +# class. | |
51 | +class Object | |
52 | + include LateObject | |
53 | + def another_late_addition | |
54 | + 4321 | |
55 | + end | |
56 | +end | |
57 | + | |
58 | +# Introduce some late methods by inclusion. | |
59 | +module GlobalModule | |
60 | + def global_inclusion | |
61 | + 42 | |
62 | + end | |
63 | +end | |
64 | +include GlobalModule | |
65 | + | |
66 | +def direct_global | |
67 | + 43 | |
68 | +end | |
69 | + | |
70 | +###################################################################### | |
71 | +# Test case for blank slate. | |
72 | +# | |
73 | +class TestBlankSlate < Test::Unit::TestCase | |
74 | + def setup | |
75 | + @bs = BlankSlate.new | |
76 | + end | |
77 | + | |
78 | + def test_undefined_methods_remain_undefined | |
79 | + assert_raise(NoMethodError) { @bs.no_such_method } | |
80 | + assert_raise(NoMethodError) { @bs.nil? } | |
81 | + end | |
82 | + | |
83 | + | |
84 | + # NOTE: NameError is acceptable because the lack of a '.' means that | |
85 | + # Ruby can't tell if it is a method or a local variable. | |
86 | + def test_undefined_methods_remain_undefined_during_instance_eval | |
87 | + assert_raise(NoMethodError, NameError) do | |
88 | + @bs.instance_eval do nil? end | |
89 | + end | |
90 | + assert_raise(NoMethodError, NameError) do | |
91 | + @bs.instance_eval do no_such_method end | |
92 | + end | |
93 | + end | |
94 | + | |
95 | + def test_private_methods_are_undefined | |
96 | + assert_raise(NoMethodError) do | |
97 | + @bs.puts "HI" | |
98 | + end | |
99 | + end | |
100 | + | |
101 | + def test_targetted_private_methods_are_undefined_during_instance_eval | |
102 | + assert_raise(NoMethodError, NameError) do | |
103 | + @bs.instance_eval do self.puts "HI" end | |
104 | + end | |
105 | + end | |
106 | + | |
107 | + def test_untargetted_private_methods_are_defined_during_instance_eval | |
108 | + oldstdout = $stdout | |
109 | + $stdout = StringIO.new | |
110 | + @bs.instance_eval do | |
111 | + puts "HI" | |
112 | + end | |
113 | + ensure | |
114 | + $stdout = oldstdout | |
115 | + end | |
116 | + | |
117 | + def test_methods_added_late_to_kernel_remain_undefined | |
118 | + assert_equal 1234, nil.late_addition | |
119 | + assert_raise(NoMethodError) { @bs.late_addition } | |
120 | + end | |
121 | + | |
122 | + def test_methods_added_late_to_object_remain_undefined | |
123 | + assert_equal 4321, nil.another_late_addition | |
124 | + assert_raise(NoMethodError) { @bs.another_late_addition } | |
125 | + end | |
126 | + | |
127 | + def test_methods_added_late_to_global_remain_undefined | |
128 | + assert_equal 42, global_inclusion | |
129 | + assert_raise(NoMethodError) { @bs.global_inclusion } | |
130 | + end | |
131 | + | |
132 | + def test_preload_method_added | |
133 | + assert Kernel.k_added_names.include?(:late_addition) | |
134 | + assert Object.o_added_names.include?(:another_late_addition) | |
135 | + end | |
136 | + | |
137 | + def test_method_defined_late_multiple_times_remain_undefined | |
138 | + assert_equal 22, nil.double_late_addition | |
139 | + assert_raise(NoMethodError) { @bs.double_late_addition } | |
140 | + end | |
141 | + | |
142 | + def test_late_included_module_in_object_is_ok | |
143 | + assert_equal 33, 1.late_object | |
144 | + assert_raise(NoMethodError) { @bs.late_object } | |
145 | + end | |
146 | + | |
147 | + def test_late_included_module_in_kernel_is_ok | |
148 | + assert_raise(NoMethodError) { @bs.late_kernel } | |
149 | + end | |
150 | + | |
151 | + def test_revealing_previously_hidden_methods_are_callable | |
152 | + with_to_s = Class.new(BlankSlate) do | |
153 | + reveal :to_s | |
154 | + end | |
155 | + assert_match /^#<.*>$/, with_to_s.new.to_s | |
156 | + end | |
157 | + | |
158 | + def test_revealing_a_hidden_method_twice_is_ok | |
159 | + with_to_s = Class.new(BlankSlate) do | |
160 | + reveal :to_s | |
161 | + reveal :to_s | |
162 | + end | |
163 | + assert_match /^#<.*>$/, with_to_s.new.to_s | |
164 | + end | |
165 | + | |
166 | + def test_revealing_unknown_hidden_method_is_an_error | |
167 | + assert_raises(RuntimeError) do | |
168 | + Class.new(BlankSlate) do | |
169 | + reveal :xyz | |
170 | + end | |
171 | + end | |
172 | + end | |
173 | + | |
174 | + def test_global_includes_still_work | |
175 | + assert_nothing_raised do | |
176 | + assert_equal 42, global_inclusion | |
177 | + assert_equal 42, Object.new.global_inclusion | |
178 | + assert_equal 42, "magic number".global_inclusion | |
179 | + assert_equal 43, direct_global | |
180 | + end | |
181 | + end | |
182 | +end | |
183 | + | ... | ... |
... | ... | @@ -0,0 +1,133 @@ |
1 | +class TestEvents < Test::Unit::TestCase | |
2 | + | |
3 | + class Target | |
4 | + attr_reader :events | |
5 | + | |
6 | + def initialize | |
7 | + @events = [] | |
8 | + end | |
9 | + | |
10 | + def start_tag(tag, attrs) | |
11 | + @events << [:start_tag, tag, attrs] | |
12 | + end | |
13 | + | |
14 | + def end_tag(tag) | |
15 | + @events << [:end_tag, tag] | |
16 | + end | |
17 | + | |
18 | + def text(string) | |
19 | + @events << [:text, string] | |
20 | + end | |
21 | + | |
22 | + end | |
23 | + | |
24 | + | |
25 | + def setup | |
26 | + @target = Target.new | |
27 | + @xml = Builder::XmlEvents.new(:target=>@target) | |
28 | + end | |
29 | + | |
30 | + def test_simple | |
31 | + @xml.one | |
32 | + expect [:start_tag, :one, nil] | |
33 | + expect [:end_tag, :one] | |
34 | + expect_done | |
35 | + end | |
36 | + | |
37 | + def test_nested | |
38 | + @xml.one { @xml.two } | |
39 | + expect [:start_tag, :one, nil] | |
40 | + expect [:start_tag, :two, nil] | |
41 | + expect [:end_tag, :two] | |
42 | + expect [:end_tag, :one] | |
43 | + expect_done | |
44 | + end | |
45 | + | |
46 | + def test_text | |
47 | + @xml.one("a") | |
48 | + expect [:start_tag, :one, nil] | |
49 | + expect [:text, "a"] | |
50 | + expect [:end_tag, :one] | |
51 | + expect_done | |
52 | + end | |
53 | + | |
54 | + def test_special_text | |
55 | + @xml.one("H&R") | |
56 | + expect [:start_tag, :one, nil] | |
57 | + expect [:text, "H&R"] | |
58 | + expect [:end_tag, :one] | |
59 | + expect_done | |
60 | + end | |
61 | + | |
62 | + def test_text_with_entity | |
63 | + @xml.one("H&R") | |
64 | + expect [:start_tag, :one, nil] | |
65 | + expect [:text, "H&R"] | |
66 | + expect [:end_tag, :one] | |
67 | + expect_done | |
68 | + end | |
69 | + | |
70 | + def test_attributes | |
71 | + @xml.a(:b=>"c", :x=>"y") | |
72 | + expect [:start_tag, :a, {:x => "y", :b => "c"}] | |
73 | + expect [:end_tag, :a] | |
74 | + expect_done | |
75 | + end | |
76 | + | |
77 | + def test_moderately_complex | |
78 | + @xml.tag! "address-book" do |x| | |
79 | + x.entry :id=>"1" do | |
80 | + x.name { | |
81 | + x.first "Bill" | |
82 | + x.last "Smith" | |
83 | + } | |
84 | + x.address "Cincinnati" | |
85 | + end | |
86 | + x.entry :id=>"2" do | |
87 | + x.name { | |
88 | + x.first "John" | |
89 | + x.last "Doe" | |
90 | + } | |
91 | + x.address "Columbus" | |
92 | + end | |
93 | + end | |
94 | + expect [:start_tag, "address-book".intern, nil] | |
95 | + expect [:start_tag, :entry, {:id => "1"}] | |
96 | + expect [:start_tag, :name, nil] | |
97 | + expect [:start_tag, :first, nil] | |
98 | + expect [:text, "Bill"] | |
99 | + expect [:end_tag, :first] | |
100 | + expect [:start_tag, :last, nil] | |
101 | + expect [:text, "Smith"] | |
102 | + expect [:end_tag, :last] | |
103 | + expect [:end_tag, :name] | |
104 | + expect [:start_tag, :address, nil] | |
105 | + expect [:text, "Cincinnati"] | |
106 | + expect [:end_tag, :address] | |
107 | + expect [:end_tag, :entry] | |
108 | + expect [:start_tag, :entry, {:id => "2"}] | |
109 | + expect [:start_tag, :name, nil] | |
110 | + expect [:start_tag, :first, nil] | |
111 | + expect [:text, "John"] | |
112 | + expect [:end_tag, :first] | |
113 | + expect [:start_tag, :last, nil] | |
114 | + expect [:text, "Doe"] | |
115 | + expect [:end_tag, :last] | |
116 | + expect [:end_tag, :name] | |
117 | + expect [:start_tag, :address, nil] | |
118 | + expect [:text, "Columbus"] | |
119 | + expect [:end_tag, :address] | |
120 | + expect [:end_tag, :entry] | |
121 | + expect [:end_tag, "address-book".intern] | |
122 | + expect_done | |
123 | + end | |
124 | + | |
125 | + def expect(value) | |
126 | + assert_equal value, @target.events.shift | |
127 | + end | |
128 | + | |
129 | + def expect_done | |
130 | + assert_nil @target.events.shift | |
131 | + end | |
132 | + | |
133 | +end | ... | ... |
... | ... | @@ -0,0 +1,449 @@ |
1 | +#!/usr/bin/env ruby | |
2 | + | |
3 | +#-- | |
4 | +# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org). | |
5 | +# Portions copyright 2005 by Sam Ruby (rubys@intertwingly.net). | |
6 | +# All rights reserved. | |
7 | + | |
8 | +# Permission is granted for use, copying, modification, distribution, | |
9 | +# and distribution of modified versions of this work as long as the | |
10 | +# above copyright notice is included. | |
11 | +#++ | |
12 | + | |
13 | +require 'test/unit' | |
14 | +require 'test/preload' | |
15 | +require 'builder' | |
16 | +require 'builder/xmlmarkup' | |
17 | + | |
18 | +class TestMarkup < Test::Unit::TestCase | |
19 | + def setup | |
20 | + @xml = Builder::XmlMarkup.new | |
21 | + end | |
22 | + | |
23 | + def test_create | |
24 | + assert_not_nil @xml | |
25 | + end | |
26 | + | |
27 | + def test_simple | |
28 | + @xml.simple | |
29 | + assert_equal "<simple/>", @xml.target! | |
30 | + end | |
31 | + | |
32 | + def test_value | |
33 | + @xml.value("hi") | |
34 | + assert_equal "<value>hi</value>", @xml.target! | |
35 | + end | |
36 | + | |
37 | + def test_nested | |
38 | + @xml.outer { |x| x.inner("x") } | |
39 | + assert_equal "<outer><inner>x</inner></outer>", @xml.target! | |
40 | + end | |
41 | + | |
42 | + def test_attributes | |
43 | + @xml.ref(:id => 12) | |
44 | + assert_equal %{<ref id="12"/>}, @xml.target! | |
45 | + end | |
46 | + | |
47 | + def test_string_attributes_are_quoted_by_default | |
48 | + @xml.ref(:id => "H&R") | |
49 | + assert_equal %{<ref id="H&R"/>}, @xml.target! | |
50 | + end | |
51 | + | |
52 | + def test_symbol_attributes_are_unquoted_by_default | |
53 | + @xml.ref(:id => :"H&R") | |
54 | + assert_equal %{<ref id="H&R"/>}, @xml.target! | |
55 | + end | |
56 | + | |
57 | + def test_attributes_quoted_can_be_turned_on | |
58 | + @xml = Builder::XmlMarkup.new | |
59 | + @xml.ref(:id => "<H&R \"block\">") | |
60 | + assert_equal %{<ref id="<H&R "block">"/>}, @xml.target! | |
61 | + end | |
62 | + | |
63 | + def test_mixed_attribute_quoting_with_nested_builders | |
64 | + x = Builder::XmlMarkup.new(:target=>@xml) | |
65 | + @xml.ref(:id=>:"H&R") { | |
66 | + x.element(:tag=>"Long&Short") | |
67 | + } | |
68 | + assert_equal "<ref id=\"H&R\"><element tag=\"Long&Short\"/></ref>", | |
69 | + @xml.target! | |
70 | + end | |
71 | + | |
72 | + def test_multiple_attributes | |
73 | + @xml.ref(:id => 12, :name => "bill") | |
74 | + assert_match %r{^<ref( id="12"| name="bill"){2}/>$}, @xml.target! | |
75 | + end | |
76 | + | |
77 | + def test_attributes_with_text | |
78 | + @xml.a("link", :href=>"http://onestepback.org") | |
79 | + assert_equal %{<a href="http://onestepback.org">link</a>}, @xml.target! | |
80 | + end | |
81 | + | |
82 | + def test_complex | |
83 | + @xml.body(:bg=>"#ffffff") { |x| | |
84 | + x.title("T", :style=>"red") | |
85 | + } | |
86 | + assert_equal %{<body bg="#ffffff"><title style="red">T</title></body>}, @xml.target! | |
87 | + end | |
88 | + | |
89 | + def test_funky_symbol | |
90 | + @xml.tag!("non-ruby-token", :id=>1) { |x| x.ok } | |
91 | + assert_equal %{<non-ruby-token id="1"><ok/></non-ruby-token>}, @xml.target! | |
92 | + end | |
93 | + | |
94 | + def test_tag_can_handle_private_method | |
95 | + @xml.tag!("loop", :id=>1) { |x| x.ok } | |
96 | + assert_equal %{<loop id="1"><ok/></loop>}, @xml.target! | |
97 | + end | |
98 | + | |
99 | + def test_no_explicit_marker | |
100 | + @xml.p { |x| x.b("HI") } | |
101 | + assert_equal "<p><b>HI</b></p>", @xml.target! | |
102 | + end | |
103 | + | |
104 | + def test_reference_local_vars | |
105 | + n = 3 | |
106 | + @xml.ol { |x| n.times { x.li(n) } } | |
107 | + assert_equal "<ol><li>3</li><li>3</li><li>3</li></ol>", @xml.target! | |
108 | + end | |
109 | + | |
110 | + def test_reference_methods | |
111 | + @xml.title { |x| x.a { x.b(name) } } | |
112 | + assert_equal "<title><a><b>bob</b></a></title>", @xml.target! | |
113 | + end | |
114 | + | |
115 | + def test_append_text | |
116 | + @xml.p { |x| x.br; x.text! "HI" } | |
117 | + assert_equal "<p><br/>HI</p>", @xml.target! | |
118 | + end | |
119 | + | |
120 | + def test_ambiguous_markup | |
121 | + ex = assert_raises(ArgumentError) { | |
122 | + @xml.h1("data1") { b } | |
123 | + } | |
124 | + assert_match /\btext\b/, ex.message | |
125 | + assert_match /\bblock\b/, ex.message | |
126 | + end | |
127 | + | |
128 | + def test_capitalized_method | |
129 | + @xml.P { |x| x.B("hi"); x.BR(); x.EM { x.text! "world" } } | |
130 | + assert_equal "<P><B>hi</B><BR/><EM>world</EM></P>", @xml.target! | |
131 | + end | |
132 | + | |
133 | + def test_escaping | |
134 | + @xml.div { |x| x.text! "<hi>"; x.em("H&R Block") } | |
135 | + assert_equal %{<div><hi><em>H&R Block</em></div>}, @xml.target! | |
136 | + end | |
137 | + | |
138 | + def test_non_escaping | |
139 | + @xml.div("ns:xml"=>:"&xml;") { |x| x << "<h&i>"; x.em("H&R Block") } | |
140 | + assert_equal %{<div ns:xml="&xml;"><h&i><em>H&R Block</em></div>}, @xml.target! | |
141 | + end | |
142 | + | |
143 | + def test_return_value | |
144 | + str = @xml.x("men") | |
145 | + assert_equal @xml.target!, str | |
146 | + end | |
147 | + | |
148 | + def test_stacked_builders | |
149 | + b = Builder::XmlMarkup.new( :target => @xml ) | |
150 | + b.div { @xml.span { @xml.a("text", :href=>"ref") } } | |
151 | + assert_equal "<div><span><a href=\"ref\">text</a></span></div>", @xml.target! | |
152 | + end | |
153 | + | |
154 | + def name | |
155 | + "bob" | |
156 | + end | |
157 | +end | |
158 | + | |
159 | +class TestAttributeEscaping < Test::Unit::TestCase | |
160 | + | |
161 | + def setup | |
162 | + @xml = Builder::XmlMarkup.new | |
163 | + end | |
164 | + | |
165 | + def test_element_gt | |
166 | + @xml.title('1<2') | |
167 | + assert_equal '<title>1<2</title>', @xml.target! | |
168 | + end | |
169 | + | |
170 | + def test_element_amp | |
171 | + @xml.title('AT&T') | |
172 | + assert_equal '<title>AT&T</title>', @xml.target! | |
173 | + end | |
174 | + | |
175 | + def test_element_amp2 | |
176 | + @xml.title('&') | |
177 | + assert_equal '<title>&amp;</title>', @xml.target! | |
178 | + end | |
179 | + | |
180 | + def test_attr_less | |
181 | + @xml.a(:title => '2>1') | |
182 | + assert_equal '<a title="2>1"/>', @xml.target! | |
183 | + end | |
184 | + | |
185 | + def test_attr_amp | |
186 | + @xml.a(:title => 'AT&T') | |
187 | + assert_equal '<a title="AT&T"/>', @xml.target! | |
188 | + end | |
189 | + | |
190 | + def test_attr_quot | |
191 | + @xml.a(:title => '"x"') | |
192 | + assert_equal '<a title=""x""/>', @xml.target! | |
193 | + end | |
194 | + | |
195 | +end | |
196 | + | |
197 | +class TestNameSpaces < Test::Unit::TestCase | |
198 | + def setup | |
199 | + @xml = Builder::XmlMarkup.new(:indent=>2) | |
200 | + end | |
201 | + | |
202 | + def test_simple_name_spaces | |
203 | + @xml.rdf :RDF | |
204 | + assert_equal "<rdf:RDF/>\n", @xml.target! | |
205 | + end | |
206 | + | |
207 | + def test_long | |
208 | + xml = Builder::XmlMarkup.new(:indent=>2) | |
209 | + xml.instruct! | |
210 | + xml.rdf :RDF, | |
211 | + "xmlns:rdf" => :"&rdf;", | |
212 | + "xmlns:rdfs" => :"&rdfs;", | |
213 | + "xmlns:xsd" => :"&xsd;", | |
214 | + "xmlns:owl" => :"&owl;" do | |
215 | + xml.owl :Class, :'rdf:ID'=>'Bird' do | |
216 | + xml.rdfs :label, 'bird' | |
217 | + xml.rdfs :subClassOf do | |
218 | + xml.owl :Restriction do | |
219 | + xml.owl :onProperty, 'rdf:resource'=>'#wingspan' | |
220 | + xml.owl :maxCardinality,1,'rdf:datatype'=>'&xsd;nonNegativeInteger' | |
221 | + end | |
222 | + end | |
223 | + end | |
224 | + end | |
225 | + assert_match /^<\?xml/, xml.target! | |
226 | + assert_match /\n<rdf:RDF/m, xml.target! | |
227 | + assert_match /xmlns:rdf="&rdf;"/m, xml.target! | |
228 | + assert_match /<owl:Restriction>/m, xml.target! | |
229 | + end | |
230 | + | |
231 | +end | |
232 | + | |
233 | +class TestDeclarations < Test::Unit::TestCase | |
234 | + def setup | |
235 | + @xml = Builder::XmlMarkup.new(:indent=>2) | |
236 | + end | |
237 | + | |
238 | + def test_declare | |
239 | + @xml.declare! :element | |
240 | + assert_equal "<!element>\n", @xml.target! | |
241 | + end | |
242 | + | |
243 | + def test_bare_arg | |
244 | + @xml.declare! :element, :arg | |
245 | + assert_equal"<!element arg>\n", @xml.target! | |
246 | + end | |
247 | + | |
248 | + def test_string_arg | |
249 | + @xml.declare! :element, "string" | |
250 | + assert_equal"<!element \"string\">\n", @xml.target! | |
251 | + end | |
252 | + | |
253 | + def test_mixed_args | |
254 | + @xml.declare! :element, :x, "y", :z, "-//OASIS//DTD DocBook XML//EN" | |
255 | + assert_equal "<!element x \"y\" z \"-//OASIS//DTD DocBook XML//EN\">\n", @xml.target! | |
256 | + end | |
257 | + | |
258 | + def test_nested_declarations | |
259 | + @xml = Builder::XmlMarkup.new | |
260 | + @xml.declare! :DOCTYPE, :chapter do |x| | |
261 | + x.declare! :ELEMENT, :chapter, "(title,para+)".intern | |
262 | + end | |
263 | + assert_equal "<!DOCTYPE chapter [<!ELEMENT chapter (title,para+)>]>", @xml.target! | |
264 | + end | |
265 | + | |
266 | + def test_nested_indented_declarations | |
267 | + @xml.declare! :DOCTYPE, :chapter do |x| | |
268 | + x.declare! :ELEMENT, :chapter, "(title,para+)".intern | |
269 | + end | |
270 | + assert_equal "<!DOCTYPE chapter [\n <!ELEMENT chapter (title,para+)>\n]>\n", @xml.target! | |
271 | + end | |
272 | + | |
273 | + def test_complex_declaration | |
274 | + @xml.declare! :DOCTYPE, :chapter do |x| | |
275 | + x.declare! :ELEMENT, :chapter, "(title,para+)".intern | |
276 | + x.declare! :ELEMENT, :title, "(#PCDATA)".intern | |
277 | + x.declare! :ELEMENT, :para, "(#PCDATA)".intern | |
278 | + end | |
279 | + expected = %{<!DOCTYPE chapter [ | |
280 | + <!ELEMENT chapter (title,para+)> | |
281 | + <!ELEMENT title (#PCDATA)> | |
282 | + <!ELEMENT para (#PCDATA)> | |
283 | +]> | |
284 | +} | |
285 | + assert_equal expected, @xml.target! | |
286 | + end | |
287 | +end | |
288 | + | |
289 | + | |
290 | +class TestSpecialMarkup < Test::Unit::TestCase | |
291 | + def setup | |
292 | + @xml = Builder::XmlMarkup.new(:indent=>2) | |
293 | + end | |
294 | + | |
295 | + def test_comment | |
296 | + @xml.comment!("COMMENT") | |
297 | + assert_equal "<!-- COMMENT -->\n", @xml.target! | |
298 | + end | |
299 | + | |
300 | + def test_indented_comment | |
301 | + @xml.p { @xml.comment! "OK" } | |
302 | + assert_equal "<p>\n <!-- OK -->\n</p>\n", @xml.target! | |
303 | + end | |
304 | + | |
305 | + def test_instruct | |
306 | + @xml.instruct! :abc, :version=>"0.9" | |
307 | + assert_equal "<?abc version=\"0.9\"?>\n", @xml.target! | |
308 | + end | |
309 | + | |
310 | + def test_indented_instruct | |
311 | + @xml.p { @xml.instruct! :xml } | |
312 | + assert_match %r{<p>\n <\?xml version="1.0" encoding="UTF-8"\?>\n</p>\n}, | |
313 | + @xml.target! | |
314 | + end | |
315 | + | |
316 | + def test_instruct_without_attributes | |
317 | + @xml.instruct! :zz | |
318 | + assert_equal "<?zz?>\n", @xml.target! | |
319 | + end | |
320 | + | |
321 | + def test_xml_instruct | |
322 | + @xml.instruct! | |
323 | + assert_match /^<\?xml version="1.0" encoding="UTF-8"\?>$/, @xml.target! | |
324 | + end | |
325 | + | |
326 | + def test_xml_instruct_with_overrides | |
327 | + @xml.instruct! :xml, :encoding=>"UCS-2" | |
328 | + assert_match /^<\?xml version="1.0" encoding="UCS-2"\?>$/, @xml.target! | |
329 | + end | |
330 | + | |
331 | + def test_xml_instruct_with_standalong | |
332 | + @xml.instruct! :xml, :encoding=>"UCS-2", :standalone=>"yes" | |
333 | + assert_match /^<\?xml version="1.0" encoding="UCS-2" standalone="yes"\?>$/, @xml.target! | |
334 | + end | |
335 | + | |
336 | + def test_no_blocks | |
337 | + assert_raises(Builder::IllegalBlockError) do | |
338 | + @xml.instruct! { |x| x.hi } | |
339 | + end | |
340 | + assert_raises(Builder::IllegalBlockError) do | |
341 | + @xml.comment!(:element) { |x| x.hi } | |
342 | + end | |
343 | + end | |
344 | + | |
345 | + def test_cdata | |
346 | + @xml.cdata!("TEST") | |
347 | + assert_equal "<![CDATA[TEST]]>\n", @xml.target! | |
348 | + end | |
349 | + | |
350 | + def test_cdata_with_ampersand | |
351 | + @xml.cdata!("TEST&CHECK") | |
352 | + assert_equal "<![CDATA[TEST&CHECK]]>\n", @xml.target! | |
353 | + end | |
354 | +end | |
355 | + | |
356 | +class TestIndentedXmlMarkup < Test::Unit::TestCase | |
357 | + def setup | |
358 | + @xml = Builder::XmlMarkup.new(:indent=>2) | |
359 | + end | |
360 | + | |
361 | + def test_one_level | |
362 | + @xml.ol { |x| x.li "text" } | |
363 | + assert_equal "<ol>\n <li>text</li>\n</ol>\n", @xml.target! | |
364 | + end | |
365 | + | |
366 | + def test_two_levels | |
367 | + @xml.p { |x| | |
368 | + x.ol { x.li "text" } | |
369 | + x.br | |
370 | + } | |
371 | + assert_equal "<p>\n <ol>\n <li>text</li>\n </ol>\n <br/>\n</p>\n", @xml.target! | |
372 | + end | |
373 | + | |
374 | + def test_initial_level | |
375 | + @xml = Builder::XmlMarkup.new(:indent=>2, :margin=>4) | |
376 | + @xml.name { |x| x.first("Jim") } | |
377 | + assert_equal " <name>\n <first>Jim</first>\n </name>\n", @xml.target! | |
378 | + end | |
379 | + | |
380 | + class TestXmlEvents < Test::Unit::TestCase | |
381 | + def setup | |
382 | + @handler = EventHandler.new | |
383 | + @xe = Builder::XmlEvents.new(:target=>@handler) | |
384 | + end | |
385 | + | |
386 | + def test_simple | |
387 | + @xe.p | |
388 | + assert_equal [:start, :p, nil], @handler.events.shift | |
389 | + assert_equal [:end, :p], @handler.events.shift | |
390 | + end | |
391 | + | |
392 | + def test_text | |
393 | + @xe.p("HI") | |
394 | + assert_equal [:start, :p, nil], @handler.events.shift | |
395 | + assert_equal [:text, "HI"], @handler.events.shift | |
396 | + assert_equal [:end, :p], @handler.events.shift | |
397 | + end | |
398 | + | |
399 | + def test_attributes | |
400 | + @xe.p("id"=>"2") | |
401 | + ev = @handler.events.shift | |
402 | + assert_equal [:start, :p], ev[0,2] | |
403 | + assert_equal "2", ev[2]['id'] | |
404 | + assert_equal [:end, :p], @handler.events.shift | |
405 | + end | |
406 | + | |
407 | + def test_indented | |
408 | + @xml = Builder::XmlEvents.new(:indent=>2, :target=>@handler) | |
409 | + @xml.p { |x| x.b("HI") } | |
410 | + assert_equal [:start, :p, nil], @handler.events.shift | |
411 | + assert_equal "\n ", pop_text | |
412 | + assert_equal [:start, :b, nil], @handler.events.shift | |
413 | + assert_equal "HI", pop_text | |
414 | + assert_equal [:end, :b], @handler.events.shift | |
415 | + assert_equal "\n", pop_text | |
416 | + assert_equal [:end, :p], @handler.events.shift | |
417 | + end | |
418 | + | |
419 | + def pop_text | |
420 | + result = '' | |
421 | + while ! @handler.events.empty? && @handler.events[0][0] == :text | |
422 | + result << @handler.events[0][1] | |
423 | + @handler.events.shift | |
424 | + end | |
425 | + result | |
426 | + end | |
427 | + | |
428 | + class EventHandler | |
429 | + attr_reader :events | |
430 | + def initialize | |
431 | + @events = [] | |
432 | + end | |
433 | + | |
434 | + def start_tag(sym, attrs) | |
435 | + @events << [:start, sym, attrs] | |
436 | + end | |
437 | + | |
438 | + def end_tag(sym) | |
439 | + @events << [:end, sym] | |
440 | + end | |
441 | + | |
442 | + def text(txt) | |
443 | + @events << [:text, txt] | |
444 | + end | |
445 | + end | |
446 | + end | |
447 | + | |
448 | +end | |
449 | + | ... | ... |
... | ... | @@ -0,0 +1,785 @@ |
1 | +== 0.3.11 2009-06-05 | |
2 | + | |
3 | +This release just fixes a tiny bug in the formatter to fix an incompatibility | |
4 | +with the latest RedMine release. It should have been included in 0.3.10, but | |
5 | +was forgotten. | |
6 | + | |
7 | +=== Bugfixes | |
8 | +* Formatter API was broken in 0.3.9 (Roman Chernyatchik) | |
9 | + | |
10 | +== 0.3.10 2009-06-05 | |
11 | + | |
12 | +The Spork Release! | |
13 | + | |
14 | +This release has an exciting new feature - a new --drb switch! This magic switch lets you run your | |
15 | +features much faster than before, because you can eliminate the startup time for your code. This is | |
16 | +thanks to a brand new gem called Spork by Tim Harper and Ben Mabey. (You can find out more about Spork | |
17 | +here: http://github.com/timcharper/spork/tree/master). You can start Spork and have it preload your | |
18 | +application in a separate process. Spork listens for DRb connections, and when you run cucumber with | |
19 | +--drb the features will run inside the Spork server instead. Spork provides two simple hooks for preloading | |
20 | +your application - one for framework/stable code (Spork.prefork) and one for the code that *you* write and | |
21 | +change often (Spork.each_run). Keep in mind that all World, Before, and other Cucumber hooks need to be | |
22 | +in the Spork.each_run block. Using Spork works great for Ruby on Rails, which can take a while to load, | |
23 | +but --drb and Spork aren't tied to Rails at all. The new --drb switch also works great alongside autotest | |
24 | +(just add --drb to your autotest profile in cucumber.yml), so now you can get even faster feedback. | |
25 | + | |
26 | +Cucumber's built-in cucumber generator now has a new --spork switch, so when you bootstrap your Rails | |
27 | +application for cucumber, you can have spork configuration set up out of the box. (It's just a | |
28 | +slightly different env.rb.) | |
29 | + | |
30 | +Although Spork was in mind when the --drb switch was added it is important to realize that all that was added | |
31 | +to Cucumber was a DRb client. Any DRb server that adheres to this protocol can be used with Cucumber's --drb | |
32 | +switch. While Spork is geared towards removing the load time to give you a faster feedback loop you could | |
33 | +just as easily use this client with a server that distributes your features to run in parallel. Someone just | |
34 | +needs to write such a server. ;) | |
35 | + | |
36 | +This release also has some minor bugfixes related to RSpec and Rails interop. | |
37 | + | |
38 | +=== Bugfixes | |
39 | +* RSpec's be_* matchers did not work in 0.3.9 and probably earlier versions. Now they do. (Aslak Hellesøy) | |
40 | +* The Rails cucumber environment won't declare gem dependencies if the plugin exists. (Aslak Hellesøy) | |
41 | +* The Rails cucumber generator will no longer declare gem dependencies on rspec if you use --testunit. (Aslak Hellesøy) | |
42 | + | |
43 | +=== New features | |
44 | +* Spork support via --drb. (Ben Mabey) | |
45 | +* Added a Ast::Feature#name method for convenience. (Aslak Hellesøy) | |
46 | + | |
47 | +=== Changed features | |
48 | +* The HTML formatter wraps examples in a div, and distinguishes between Scenario and Scenario Outline. (Aslak Hellesøy) | |
49 | + | |
50 | +== 0.3.9 2009-05-27 | |
51 | + | |
52 | +Bugfix release for 0.3.8 released earlier today. 0.3.8 had a bug in the Rails cucumber | |
53 | +generator which is fixed in 0.3.9. | |
54 | + | |
55 | +=== Bugfixes | |
56 | +* Fix broken Rails cucumber generator (Tim Glen) | |
57 | +* The Cucumber Rake task in non-fork mode will properly cause Rake to exit with 1 when Cucumber fails. (Aslak Hellesøy) | |
58 | + | |
59 | +== 0.3.8 2009-05-27 | |
60 | + | |
61 | +This Cucumber version fixes several bugs related to Ruby on Rails and RSpec. If you | |
62 | +use Cucumber with a Rails app we *strongly* recommend you bootstrap Cucumber again: | |
63 | + | |
64 | + ruby script/generate cucumber | |
65 | + | |
66 | +=== New Features | |
67 | +* Rails cucumber generator sets up default gem dependencies in cucumber environment. | |
68 | +* The duration of a run is reported by formatters - same format as the Linux time command (#228 Aslak Hellesøy) | |
69 | +* Scenario and ExampleRow objects (passed to Before and After hooks) have #name and #line methods (#316 Aslak Hellesøy) | |
70 | +* Rails generator creates a cucumber environment file to avoid potential cache_classes conflicts in test.rb (#165, Ben Mabey) | |
71 | +* HTML formatter renders @tags (but the CSS is still ugly) | |
72 | + | |
73 | +=== Removed/changed features | |
74 | +* The Cucumber Rake task will again fork by default (as 0.3.3 and earlier). Forking must be turned off explicitly. (Aslak Hellesøy) | |
75 | + | |
76 | +=== Bugfixes | |
77 | +* Better coexistence with RSpec - Cucumber now *neuters* the part of RSpec that tries to parse ARGV. | |
78 | +* The differ= exception is gone (#325, #340 Aslak Hellesøy) | |
79 | + | |
80 | +== 0.3.7 2009-05-22 | |
81 | + | |
82 | +This is the "Help JetBrains RubyMine" release! | |
83 | + | |
84 | +=== New Features | |
85 | +* Added new Given alias for Catalan: Donat|Donada (Lleïr Borràs Metje) | |
86 | +* New --expand option. This will print Scenario Outlines once for each Example row - with values expanded. (#327 Aslak Hellesøy) | |
87 | +* You can override the formatter in Rails-generated rake tasks with the CUCUMBER_FORMAT environment variable (#335 Aslak Hellesøy) | |
88 | + | |
89 | +=== Bugfixes | |
90 | +* 'specs' folder needs to be renamed back to 'spec' (#339 Aslak Hellesøy) | |
91 | +* CUCUMBER_OPTS doesn't work for cucumber rake tasks (#336 Aslak Hellesøy) | |
92 | + | |
93 | +== 0.3.6 2009-05-20 | |
94 | + | |
95 | +Kanban! With this release you can tag features or scenarios that are work in progress | |
96 | +with a tag and use the new --wip switch. | |
97 | + | |
98 | +Another handy feature in this release is that you can package your own formatters in RubyGems. | |
99 | + | |
100 | +=== New features | |
101 | +* New --wip switch. See http://www.jroller.com/perryn/entry/bdd_on_a_multi_disciplined (Perryn Fowler) | |
102 | +* Added a AfterStep hook (Luke Melia) | |
103 | +* New aliases for Vietnamese (Ngoc Dao) | |
104 | +* Automatic require of custom formatters. --require is no longer needed to load them, and they can be in Ruby gems. (Aslak Hellesøy) | |
105 | +* Lazy loading of built-in formatters. Should improve startup time a little bit. | |
106 | + | |
107 | +=== Bugfixes | |
108 | +* Gracefully handle exceptions in After block (#330 Matt Wynne) | |
109 | +* Feature with only Background doesn't run hooks (#314, #329 Aslak Hellesøy) | |
110 | + | |
111 | +== 0.3.5 2009-05-14 | |
112 | + | |
113 | +Let's make a new release today because two annoying bugs are fixed. | |
114 | + | |
115 | +=== Bugfixes | |
116 | +* Allow feature element names to contain Gherkin keywords as long as they are not the first word on a newline (#319, #307 Joseph Wilk) | |
117 | + | |
118 | +== 0.3.4 2009-05-14 | |
119 | + | |
120 | +A couple of great new features in this release. Running with Rake is faster than before, | |
121 | +and there is a brand new JUnit formatter - great for Continuous Integration reports! | |
122 | + | |
123 | +This release was made especially for the Oslo XP Meetup today. | |
124 | + | |
125 | +** IMPORTANT UPGRADE NOTES FOR RAILS USERS ** | |
126 | + | |
127 | +Running Cucumber features in the same Ruby interpreter as Rake doesn't seem to work, | |
128 | +so you have to explicitly tell the task to fork (like it was doing by default in prior | |
129 | +versions). In lib/tasks/cucumber.rake: | |
130 | + | |
131 | + Cucumber::Rake::Task.new(:features) do |t| | |
132 | + t.fork = true # Explicitly fork | |
133 | + t.cucumber_opts = %w{--format pretty} | |
134 | + end | |
135 | + | |
136 | +(If you run script/generate cucumber this will be done for you). | |
137 | +Alternatively you can omit forking and run features like this: | |
138 | + | |
139 | + RAILS_ENV=test rake features | |
140 | + | |
141 | +However, setting the RAILS_ENV is easy to forget, so I don't recommend relying on this. | |
142 | + | |
143 | +=== Bugfixes | |
144 | +* Hooks (World, Before, After) are no longer executed when --dry-run (Aslak Hellesøy) | |
145 | +* Proper UTF8 use in HTML formatter (Herminio Torres) | |
146 | +* Problem with multiple terms in languages.yml (#321 Aslak Hellesøy) | |
147 | + | |
148 | +=== New features | |
149 | +* New JUnit formatter (Gareth Jones) | |
150 | +* Support for Vietnamese (Ngoc Dao) | |
151 | +* Added aliases for Feature and But in Japanese (Leonard Chin) | |
152 | +* Support for Catalan (Francesc Esplugas) | |
153 | + | |
154 | +=== Changed features | |
155 | +* --exclude flag now works on ruby files in addition to feature files (#312 Ben Mabey) | |
156 | +* The Java example under examples/java uses Ant instead of Rake - and the new JUnit formatter. | |
157 | +* Rake task should not shell out (#297 Aslak Hellesøy) | |
158 | + The Cucumber Rake task will run Cucumber in the same Ruby interpreter as Rake itself | |
159 | + unless explicitly told to fork a new interpreter. This is to increase speed. You can | |
160 | + force a new interpreter by setting fork=true or rcov=true in the task. | |
161 | + | |
162 | +== 0.3.3 2009-05-10 | |
163 | + | |
164 | +Minor bugfix release, made specially for EuRuKo! | |
165 | + | |
166 | +=== Bugfixes | |
167 | +* Summaries are no longer printed in an empty () if there are no scenarios/steps (Aslak Hellesøy) | |
168 | +* Background, Scenario Outline, Before Hook interaction (#309 Aslak Hellesøy) | |
169 | +* Multiline String snippets no longer give misleading info. It's a String, not a PyString that's sent to step def. | |
170 | + | |
171 | +=== Removed/changed features | |
172 | +* New aliases: --no-source/-s, --name/-n (#317 Lonnon Foster) | |
173 | + | |
174 | +== 0.3.2 2009-05-05 | |
175 | + | |
176 | +This release has some minor bug fixes and new features. | |
177 | +Nothing major, but we need a release for RailsConf'09 in Las Vegas! | |
178 | + | |
179 | +=== Bugfixes | |
180 | +* rake tasks with profiles not respecting --require flags (#311 Ben Mabey) | |
181 | +* Step table with blank cell fails (#308 JohnnyT) | |
182 | +* Fixed error where unused table cells in Examples where raising exceptions due to having no status (#302 Joseph Wilk) | |
183 | + | |
184 | +=== New features | |
185 | +* Support for Hebrew (Ido Kanner) | |
186 | +* Summary should report scenarios (#32 Aslak Hellesøy) | |
187 | +* Examples and the associated tables are indented one level deeper than Scenario Outline. (Aslak Hellesøy) | |
188 | +* Added support for Examples selection when using --name. (#295 Joseph Wilk) | |
189 | + | |
190 | +== 0.3.1 2009-04-26 | |
191 | + | |
192 | +This release has several minor bug fixes and new features. With the addition of Latvian and Hungarian Cucumber | |
193 | +now supports 32(!!) languages. | |
194 | + | |
195 | +=== New features | |
196 | +* Support multiline names for Scenarios, Scenario Outlines, Backgrounds, Examples (#231 Joseph Wilk) | |
197 | +* Added #headers to Cucumber::Ast::Table (Ben Mabey) | |
198 | +* New translation for Latvian (Vitauts Stočka) | |
199 | +* New translation for Hungarian (#287 Bence Golda) | |
200 | +* Pick up failure on after hook (#272 Aslak Hellesøy) | |
201 | + | |
202 | +=== Bugfixes | |
203 | +* Pretty formatter not colouring Examples tables correctly (#304 Aslak Hellesøy) | |
204 | +* Problem using --scenario and Scenario Outline (#298 Aslak Hellesøy) | |
205 | +* Tag Hook gets executed always there is a background (#301 Aslak Hellesøy) | |
206 | +* Feature which only has a Background with steps causes an exception (#306 Aslak Hellesøy) | |
207 | +* Gem no longer depends on Hoe (Aslak Hellesøy) | |
208 | +* Span html tags appear on HTML results with 0.3.0 (#299 Aslak Hellesøy) | |
209 | +* Fixed incorrect colours in pretty formatter's table headers for outline tables (Aslak Hellesøy) | |
210 | +* Exceptions from steps called within hooks are now reraised. (#294 Ben Mabey) | |
211 | + | |
212 | +=== Removed/changed features | |
213 | +* --scenario handle has been removed and replaced with --name which supports partial matches, regexp special characters, running named backgrounds (#295 Joseph Wilk) | |
214 | + | |
215 | +== 0.3.0 2009-04-14 | |
216 | + | |
217 | +This release has some minor changes to the APIs, but big enough that a new major release is in order. | |
218 | +The biggest change is the new semantics of the #World method. Previously you would call this method | |
219 | +several times, passing a Proc and extending the world object of the previous one with a Ruby module. | |
220 | +The problem was that there was no nice way to ensure the order in which these procs were called, which | |
221 | +led to some unexpected situations. In this release you can only register a single World proc. If you | |
222 | +want to extend a world with certain modules, you simply call the #World method with the module(s) | |
223 | +you wish to extend the World with. The Sinatra example illustrates how to do this. Also check out | |
224 | +the RDoc for Cucumber::StepMother#World. | |
225 | + | |
226 | +The Visitor API (which is used for formatters) has also changed slightly. However, we have tried to | |
227 | +do this in a backwards compatible way, so if you have custom formatters for Cucumber 0.2 they should | |
228 | +still work. | |
229 | + | |
230 | +One of the most significant new features is Tagged Hooks: http://wiki.github.com/aslakhellesoy/cucumber/hooks | |
231 | +This lets you associate Before and After blocks with specific scenarios. | |
232 | + | |
233 | +We are also deprecating the step_list, step_pattern, feature_list, and feature_pattern accessors on | |
234 | +Cucumber::Rake::Task. These accessors will be completely removed in version 0.4. For complex settings | |
235 | +please rely on cucumber profiles in your rake tasks: | |
236 | +http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles | |
237 | + | |
238 | +=== New features | |
239 | +* Use Hooks with @tags (#229 Aslak Hellesøy) | |
240 | +* Rake task supports cucumber.yml profiles (#187 Ben Mabey) | |
241 | +* Field value steps for Webrat (Jack Chen) | |
242 | +* Added translation for Bulgarian (Krasimir Angelov) | |
243 | +* Updated translation for Polish (#273 Grzegorz Marszałek) | |
244 | +* Only a single World proc can be registered. World extension now happens by calling #World with ruby modules. | |
245 | +* Portuguese uses Funcionalidade in stead of Característica and accented words are aliased with unaccented ones (Alexandre da Silva and Felipe Coury). | |
246 | +* The usage formatter also prints unused step definitions (Aslak Hellesøy) | |
247 | +* Better exception if a World proc returns nil. (Aslak Hellesøy) | |
248 | +* Allow Step Definitions to use |*varargs|, but only on Ruby 1.9. (Aslak Hellesøy) | |
249 | +* Snippets for steps that use Step Tables or PyStrings include block param and object type hint comment (#247 Joseph Wilk) | |
250 | +* Support description string for Backgrounds (#271 Joseph Wilk) | |
251 | + | |
252 | +=== Bugfixes | |
253 | +* After methods not being executed when Background fails (#288 Luismi Cavallé) | |
254 | +* Fixed dependency on internal files in rspec breaks cucumber w/ rspec-1.2.4 (#291 Aslak Hellesøy) | |
255 | +* Fix color use when using autotest on Linux. (Hans de Graaff) | |
256 | +* Fixed incorrect calculation of pystring indentation (#279 Eugene Naydanov) | |
257 | +* Fixed --format html leads to an error (#252 Aslak Hellesøy) | |
258 | +* Fixed Background runs twice (#255 Aslak Hellesøy) | |
259 | +* Fixed Background Transactions and :xx (#270 Aslak Hellesøy) | |
260 | +* Fixed Autospec failing with cucumber 0.2 (#254 Aslak Hellesøy) | |
261 | +* Sibling file detecting not working (#278 Aslak Hellesøy) | |
262 | + | |
263 | +=== Removed/changed features | |
264 | +* The visitor API has changed slightly: | |
265 | +** #visit_step_name, #visit_multiline_arg and #visit_exception are no longer official API methods. | |
266 | +** #visit_step_result replaces those 3 methods. | |
267 | +** Table and PyString no longer hold status information. Each visitor subclass should store state in @state if needed. | |
268 | +** #visit_py_string no longer takes a status argument. | |
269 | + | |
270 | +== 0.2.3 2009-03-30 | |
271 | + | |
272 | +This release sports 4 updated languages, slightly better help with snippets if you "quote" arguments | |
273 | +in your steps. Windows/JRuby users can enjoy colours and you get some more sugar with Tables. | |
274 | + | |
275 | +=== New features | |
276 | +* Added new Then /^I should be on (.+)$/ do |page_name| step (Grant Hollingworth) | |
277 | +* Use skipped_param color for examples table header (#266 Eugene Naydanov) | |
278 | +* Added new Cucumber::Ast::Table#rows_hash method (Torbjørn Vatn) | |
279 | +* Windows/JRuby users can now enjoy colourful output (via http://github.com/aslakhellesoy/ansicolor) (#166 Aslak Hellesøy) | |
280 | +* Ambiguous step errors hint about --guess (unless --guess already on) (Aslak Hellesøy) | |
281 | +* Added translation for Slovak (Ahmed Al Hafoudh) | |
282 | +* Updated translation for Dutch (Bart Zonneveld) | |
283 | +* Updated translation for Italian (Alessandro Baroni) | |
284 | +* Updated translation for Japanese (KAKUTANI Shintaro) | |
285 | + | |
286 | +=== Bugfixes | |
287 | +* Fixed step name after step keyword without space (#265 Aslak Hellesøy) | |
288 | +* Backtrace is back in HTML reports (Aslak Hellesøy) | |
289 | + | |
290 | +== 0.2.2 2009-03-25 | |
291 | + | |
292 | +This release includes some minor changes to make Cucumber work with pure Java. Cucumber | |
293 | +has already worked with Java for a while (using JRuby and step definitions in Ruby), | |
294 | +but now you can write step definitions in pure Java! | |
295 | + | |
296 | +Check out the Cucumber Java project for more details: | |
297 | +http://github.com/aslakhellesoy/cucumber_java/tree/master | |
298 | + | |
299 | +== 0.2.1 2009-03-25 | |
300 | + | |
301 | +This release fixes a few minor bugs and adds a couple of new features. | |
302 | + | |
303 | +== Bugfixes | |
304 | +* Fixed Cucumber, and rails controller error handling (#49 Matt Patterson) | |
305 | +* HTML Formatter doesn't work correctly with scenario Outlines. (#260 Aslak Hellesøy) | |
306 | +* After blocks are run in reverse order of registration. (#113 Aslak Hellesøy) | |
307 | +* Snippets are showing 'Ands' (#249 Aslak Hellesøy) | |
308 | + | |
309 | +=== New features | |
310 | +* Snippets use a regexp and block arguments if the step name has "quoted" arguments. (Aslak Hellesøy) | |
311 | +* Cucumber::Ast::Feature#to_sexp includes the file name. (Aslak Hellesøy) | |
312 | +* support/env.rb is not loaded when --dry-run is specified. This is to increase performance. (Aslak Hellesøy) | |
313 | +* New usage formatter. This is the foundation for editor autocompletion and navigation between steps and step definitions. (#209 Aslak Hellesøy) | |
314 | + | |
315 | +=== Removed features | |
316 | +* -S/--step-definitions option introduced in 0.2.0 is removed. Use --format usage [--dry-run] [--no-color]. | |
317 | + | |
318 | +== 0.2.0 2009-03-18 | |
319 | + | |
320 | +This release sports a bunch of new and exciting features, as well a major rewrite of Cucumber's internals. | |
321 | +The rewrite was done to address technical debt and to have a code base that is easier to evolve and maintain. | |
322 | + | |
323 | +There are some changes to the Gherkin language that breaks backwards compatible with the 0.1.x series. | |
324 | +Most importantly, "GivenScenario" and "More Examples" no longer exist. See the "Removed features" section | |
325 | +below for more details on how to use alternatives. | |
326 | + | |
327 | +Since the grammar has changed, there are some new keywords. We have to rely on the community | |
328 | +to provide updated translations. This is much easier than before - just update languages.yml. | |
329 | +There is no static code generation anymore. To list all languages: | |
330 | + | |
331 | + cucumber --lang help | |
332 | + | |
333 | +And to list the keywords for a particular language: | |
334 | + | |
335 | + cucumber --lang en-lol help | |
336 | + | |
337 | +There are some really awesome new features in this release: Tagging, Autoformatting, automatic | |
338 | +aliasing of keywords in all languages, full Ruby 1.9 support and improved output | |
339 | +for multiline arguments are some of the highlights. | |
340 | + | |
341 | +== Bugfixes | |
342 | +* New StepInvocation breaks console formatter for pending steps. (#241 Jacob Radford) | |
343 | +* Within Scenario Outlines when replacing with a nil in a step name use empty string instead. (#237 Joseph Wilk) | |
344 | +* Fixed bug with Scenario Outlines incorrectly replacing values in step tables with nil. (#237 Joseph Wilk) | |
345 | +* Within Scenario Outlines when replacing with a nil in multiline strings use empty string instead. (#238 Joseph Wilk) | |
346 | +* Re-structure the ast: Feature -> Background -> (Scenario|ScenarioOutline)*. Fixes bug with background being called outside transactions. (#181 Joseph Wilk) | |
347 | +* --strict always exits with status 1 (#230 Tim Cuthbertson) | |
348 | +* Fix error with nil values in tables raising an exception (#227 Joseph Wilk) | |
349 | +* Add support for using << in formatters to ensure the html formatter works (#210 Joseph Wilk) | |
350 | +* Explicitly require env.rb files first to avoid potential load order problems. (#213, Ben Mabey, Randy Harmon) | |
351 | +* Depend on polyglot version (0.2.4) to avoid masking require errors. (Aslak Hellesøy). | |
352 | +* -n option does not suppress the line info for a Scenario Outline (#175 Aslak Hellesøy) | |
353 | +* Errors with rspec-rails matchers in cucumber 0.1.99 (#173 David Chelimsky) | |
354 | +* Can't use an empty string as a table value in a scenario outline (#172 Aslak Hellesøy) | |
355 | +* Really skip skipped steps (#90 Aslak Hellesøy) | |
356 | +* No output for multi-line strings (#71 Aslak Hellesøy) | |
357 | +* Fix cucumber/formatter/unicode flaws on Windows (#145 Michael) | |
358 | +* Autotest-related Bugs: YAML missing (#136 Tobias Pape) | |
359 | +* Overeager "rescue LoadError" hides lots of errors (#137 Jonathan del Strother) | |
360 | +* Nested steps don't show mismatch (#116 Aslak Hellesøy) | |
361 | +* Pending steps in > steps called from steps (#65 Aslak Hellesøy) | |
362 | + | |
363 | +=== New features | |
364 | +* Australian translation (Josh Graham) | |
365 | +* Added World#announce(announcment) which lets you output text to the formatted output (#222 Rob Kaufmann) | |
366 | +* Added Table#transpose to to allow use of vertically aligned table keys (Torbjørn Vatn, Aslak Hellesøy) | |
367 | +* Added Table#map_headers to to allow use of more readable headers (Rob Holland) | |
368 | +* New -S/--step-definitions option. Useful (among other things) for tools that implement automcompletion. (#208 Aslak Hellesøy). | |
369 | +* The cucumber.rake file defines a dummy :features task if Cucumber is not installed (#225 Josh Nichols) | |
370 | +* Added Table#map_column! to ease casting of cell values into relevant types (#223 Rob Holland) | |
371 | +* New --no-diff option (#218 Bryan Ash) | |
372 | +* Rails generators supports testunit and rspec option, defaulting to rspec (#217 Josh Nichols) | |
373 | +* Sinatra Example (#204 Rob Holland) | |
374 | +* Keywords can be aliased in languages.yml. See English for an example (examples: Examples|Scenarios) | |
375 | +* Adding support for Background (#153 Joseph Wilk) | |
376 | +* Added Česky/Czech (Vojtech Salbaba) | |
377 | +* New --no-multiline option to reduce noise in output. Useful if lots of features are failing. (Aslak Hellesøy) | |
378 | +* Added ability to pass URIs to cucumber in addition to files and directories. Useful for troubleshooting! (Aslak Hellesøy) | |
379 | +* Groups of tabular scenarios (#57 Aslak Hellesøy) | |
380 | +* Tagging scenarios and features. Pick the ones to run with --tags (#54 Aslak Hellesøy) | |
381 | +* Make the current scenario available to the steps. (#44 Aslak Hellesøy) | |
382 | +* Step definition snippets contain a 'pending' call (#84 Aslak Hellesøy) | |
383 | +* Call multiline steps from other steps (#144 Aslak Hellesøy) | |
384 | +* Run cucumber with --autoformat DIR to reformat (pretty print) all of your feature files. (Aslak Hellesøy) | |
385 | +* New --strict option exits with an error code if there are undefined steps. (#52 Aslak Hellesøy) | |
386 | +* Given, When, Then methods (used in step definitions) are automatically aliased to current language. Use $KCODE='u' in env.rb if needed. | |
387 | +* Run cucumber --language help to see all supported languages. (Aslak Hellesøy) | |
388 | +* Run cucumber --language LANG help to see keywords for a given language. (Aslak Hellesøy) | |
389 | +* Multiline arguments (tables and """ strings) are printed in the output. (Aslak Hellesøy) | |
390 | +* It's no longer necessary to compile the Treetop grammar when adding a new language. Localised parser is generated at runtime. (Aslak Hellesøy) | |
391 | +* New --guess option tries to guess the best step definition match instead of raising Cucumber::Multiple. (Jake Howerton) | |
392 | + | |
393 | +=== Removed features | |
394 | +* "GivenScenario" is gone. Instead you can call Steps from Step Definitions, or use the new Background feature (#153) | |
395 | +* "More Examples" is gone. "Scenario" + "More Examples" is no longer supported. Use "Scenario Outline" + "Examples" instead. | |
396 | +* Pure Ruby features are no longer supported. | |
397 | +* Remove --color option in autotest. Can be added manually in cucumber.yml (#215 Jean-Michel Garnier) | |
398 | + | |
399 | +== (0.1.16.4 aslakhellesoy-cucumber gem on GitHub) | |
400 | + | |
401 | +Bugfix release. | |
402 | + | |
403 | +IMPORTANT NOTE FOR RAILS USERS. | |
404 | +The template used to generate your features/support/env.rb has changed. You have to apply a minor change | |
405 | +manually for existing Rails projects when you upgrade to this version. Change this: | |
406 | + | |
407 | + require 'webrat/rspec-rails' | |
408 | + | |
409 | +to this: | |
410 | + | |
411 | + require 'webrat/core/matchers' | |
412 | + | |
413 | +=== New features | |
414 | +* Finnish translation (Tero Tilus) | |
415 | +* Use Webrat's #contain matcher in generated "I should (not) see" step definitions (Bryan Helmkamp) | |
416 | + | |
417 | +== Bugfixes | |
418 | +* Escaped quotes - \" - inside multiline strings will be unescaped. | |
419 | +* Flush output in HTML formatter since JRuby doesnt do it automatically (Diego Carrion) | |
420 | +* Better handling of ARGV (#169 David Chelimsky, Ben Mabey) | |
421 | +* Compatibility with ruby-debug (do ARGV.dup in bin/cucumber so it can restart ruby with same args) (Aslak Hellesøy) | |
422 | + | |
423 | +== 0.1.16 2009-01-19 | |
424 | + | |
425 | +This is a small bugfix release. The most notable improvement is compatibility with Webrat 0.4. Rails/Webrat users should | |
426 | +upgrade both Cucumber and Webrat gems. | |
427 | + | |
428 | +=== New features | |
429 | +* Allow argument placeholders in step tables and multiline comments (#121 Joseph Wilk) | |
430 | +* Scenario Outline can be followed by several named Examples sections (#123 Aslak Hellesøy) | |
431 | +* Add the #binary= method back to the Rake task. It is needed by merb_cucumber for running the features of a merb app with it's bundled gems. (Thomas Marek) | |
432 | +* Added a /^When I go to (.+)$/ step definition to webrat_steps.rb and a simple page name to path mapping method (Bryan Helmkamp) | |
433 | + | |
434 | +=== Bugfixes | |
435 | +* Fix to run single scenarios when the line number specified doesn't correspond to a step (i.e. blank lines or rows) (#160 Luismi Cavallé) | |
436 | + | |
437 | +=== Removed features | |
438 | + | |
439 | +== 0.1.15 2009-01-08 | |
440 | + | |
441 | +Bugfix release | |
442 | + | |
443 | +=== New features | |
444 | +* 한국어! (Korean!) (John Hwang) | |
445 | + | |
446 | +=== Bugfixes | |
447 | +* --dry-run skips running before/after/steps (#147 Ian Dees) | |
448 | +* Fix a minor bug in the console formatter's summary (David Chelimsky) | |
449 | +* Better quoting of Scenario names in Autotest (Peter Jaros) | |
450 | +* Added some small workarounds for unicode handling on Windows (Aslak Hellesøy) | |
451 | + | |
452 | +== 0.1.14 2009-01-04 | |
453 | + | |
454 | +This is the first release of Cucumber that runs on Ruby 1.9. There are still some encoding-related issues | |
455 | +with Arabic (ar), Japanese (ja) and Simplified Chinese (zh-CN). Patches are welcome. Other than that - | |
456 | +a couple of minor bug fixes and polishing. | |
457 | + | |
458 | +=== New features | |
459 | +* Pretty formatter shows number of scenarios (#139 Joseph Wilk) | |
460 | +* Rudimentary support for Ruby 1.9. Now it's ok to file Ruby 1.9-related bugs. | |
461 | + | |
462 | +=== Bugfixes | |
463 | +* Fixed "No such file or directory -- cucumber (LoadError)" bug with AutoTest (Aslak Hellesøy) | |
464 | +* Fixed `load_missing_constant': uninitialized constant Dispatcher error with Rails (Aslak Hellesøy) | |
465 | + | |
466 | +=== Removed features | |
467 | +* The #binary= method is gone from the Rake task. It will always point to the binary in the current gem. (Aslak Hellesøy) | |
468 | + | |
469 | +== 0.1.13 2008-12-20 | |
470 | + | |
471 | +It's time for some new features again. Output is now much better since you can use diffing, tweak | |
472 | +the output colours and get the full --backtrace if you want. Managing your support/* files became | |
473 | +a little easier since they are now always loaded before the step definitions. Life became easier | |
474 | +for Windows users in Norway (and other countries using unicode in the features). Plus several other | |
475 | +bug fixes. | |
476 | + | |
477 | +Enjoy! | |
478 | + | |
479 | +=== New features | |
480 | +* Console output is no longer bold, but regular. Step arguments are bold instead of blold+underlined. (Aslak Hellesøy) | |
481 | +* Console output can be configured with CUCUMBER_COLORS in your shell. (Aslak Hellesøy) | |
482 | +* Added new --backtrace option to show full backtrace (Aslak Hellesøy) | |
483 | +* Enable RSpec's diffing automatically if RSpec is loaded (Aslak Hellesøy) | |
484 | +* Files in support directories are loaded before any other file (i.e. step definitions.) (#120, Ben Mabey) | |
485 | +* The Rails features generator got some love and is now tested: http://github.com/aslakhellesoy/cucumber_rails (Aslak Hellesøy) | |
486 | +* --language is aliased to -l instead of -a (-l became available when --line was refactored) (Aslak Hellesøy) | |
487 | +* Scenario Outlines which through placeholders in the steps allow control of how scenario table values are used. (#57 Joseph Wilk) | |
488 | +* Scenario Outlines are now usable in pure ruby (Joseph Wilk) | |
489 | +* Add support for calling 'pending' from step definitions. (#112 Joseph Wilk) | |
490 | + | |
491 | +=== Bugfixes | |
492 | +* Make rails before filters work correctly (#122, #129 Guillermo Álvarez Fernández) | |
493 | +* Proper Unicode support for Windows command shells: Just require cucumber/formatter/unicode in env.rb (Aslak Hellesøy) | |
494 | +* Fixed disappearing "a" on Windows (#81 Aslak Hellesøy) | |
495 | +* Fixed a bug where row step outlines were loosing step tables. (#121 Joseph Wilk, Ben Mabey) | |
496 | +* The Cucumber Autotest plugin now launches JRuby if autotest is run with JRuby (Aslak Hellesøy) | |
497 | +* Provide helpful and non-confusing error message when specified profile is blank. (#118, Ben Mabey) | |
498 | +* Improve handling and error messages for malformed cucumber.yml files. (#117, Ben Mabey) | |
499 | +* document :x run option in command line help (#114, Aslak Hellesøy) | |
500 | +* Change 'visits' to 'visit' in features generator to comply with new Webrat API (Darius Roberts) | |
501 | + | |
502 | +=== Removed features | |
503 | + | |
504 | +== 0.1.12 2008-12-04 | |
505 | + | |
506 | +This is the "getting serious with IronRuby release" - largely based on | |
507 | +"Patrick Gannon":http://www.patrickgannon.net/archive/2008/10/23/bdd-style-feature-tests-using-ironruby-and-rspeccucumber.aspx's | |
508 | +blog entry. | |
509 | + | |
510 | +== New features | |
511 | +* Cucumber works with IronRuby/.NET - http://github.com/aslakhellesoy/cucumber/wikis/ironruby-and-net (Aslak Hellesøy) | |
512 | + | |
513 | +== Bugfixes | |
514 | +* Fixed bug which was preventing coloring under Autotest (#111, Alan Larkin) | |
515 | + | |
516 | +== Removed features | |
517 | +None | |
518 | + | |
519 | +== 0.1.11 2008-12-02 | |
520 | + | |
521 | +Bugfix release with a couple of minor additional features to the command line options. | |
522 | + | |
523 | +=== New features | |
524 | +* Capture output from cucumber in Autotest (Alan Larkin) | |
525 | +* Update cucumber generator to work with latest Webrat (Bryan Helkamp) | |
526 | +* CUCUMBR LIKEZ 2 SPEEK WIF KATS. KTHXBAI (Aimee Daniells) | |
527 | +* Support for dynamically pluggable formatters (#99 Joseph Wilk) | |
528 | +* --verbose mode to see ruby files and feature files loaded by Cucumber (#106 Joseph Wilk) | |
529 | + | |
530 | +=== Bugfixes | |
531 | +* The jcode library is not loaded on JRuby/Rails. Workaround for http://tinyurl.com/55uu3u. (Aslak Hellesøy) | |
532 | +* Support including modules for class passed to --format (#109 Joseph Wilk) | |
533 | + | |
534 | +=== Removed features | |
535 | +* The cucumber gem no longer depends on the rspec gem. It must be downloaded manually if RSpec is used. (Jeff Rafter) | |
536 | + | |
537 | +== 0.1.10 2008-11-25 | |
538 | + | |
539 | +This release mostly has smaller bugfixes. The most significant new feature is how | |
540 | +line numbers are specified. You can now run multiple features at specific lines numbers like this: | |
541 | + | |
542 | + cucumber foo.feature:15 bar.feature:6:45:111 | |
543 | + | |
544 | +This will run foo.feature at line 15 and bar.feature at line 6, 45 and 111. | |
545 | + | |
546 | +=== New features | |
547 | +* Added example showing how to use Cucumber with Test::Unit + Matchy instead of RSpec (Aslak Hellesøy) | |
548 | +* Yield existing world object to World block (#87 Aslak Hellesøy) | |
549 | +* AUTOFEATURE=tRue works (case insensitive) (Aslak Hellesøy) | |
550 | +* Initial support for .NET via IronRuby. (Aslak Hellesøy) | |
551 | +* Lithuanian translation (sauliusgrigaitis) | |
552 | +* New webrat step defintions to wrap the new selects_time, selects_date, and selects_datetime methods. (Ben Mabey) | |
553 | +* Try to load webrat gem if it's not installed as a plugin (Aslak Hellesøy) | |
554 | +* Support example.feature:20 or example.feature:10:20:30 syntax for running features at specific line number(s). (#88 Joseph Wilk) | |
555 | + | |
556 | +=== Bugfixes | |
557 | +* Windows - all the 'a' characters in the output have gone on strike (#81 Luis Lavena, Joseph Wilk, Aslak Hellesøy) | |
558 | +* Raise a nice error when encountering step definition without block (#95 Aslak Hellesøy) | |
559 | +* Features written using Ruby where breaking due to missing a line number (#91 Joseph Wilk) | |
560 | +* Directly creating a Table meant the scenario table header was never set which was causing a formatter error (#91 Joseph Wilk) | |
561 | + | |
562 | +=== Removed features | |
563 | +* $KCODE='u' is no longer done automatically. Developers should do that explicitly when needed in step definitions or env.rb. | |
564 | +* Step definition without a block being treated as pending (#64 Joseph Wilk) | |
565 | +* The --line option has been removed. Use the new file.feature:line format instead. | |
566 | + | |
567 | +== 0.1.9 2008-11-12 | |
568 | + | |
569 | +With this release Cucumber supports 19 (!) natural languages: | |
570 | + | |
571 | +* Arabic | |
572 | +* Chinese Simplified | |
573 | +* Danish | |
574 | +* Dutch | |
575 | +* Estonian | |
576 | +* French | |
577 | +* German | |
578 | +* Italian | |
579 | +* Japanese | |
580 | +* Malay | |
581 | +* Norwegian | |
582 | +* Polish | |
583 | +* Portuguese | |
584 | +* Romanian | |
585 | +* Russian | |
586 | +* Spanish | |
587 | +* Swedish | |
588 | +* Texan | |
589 | +* Welsh | |
590 | + | |
591 | +Thanks a lot to everyone who has contributed translations. If you don't see your language here, please | |
592 | +add it: http://github.com/aslakhellesoy/cucumber/wikis/spoken-languages | |
593 | + | |
594 | +Main functional changes in this release is "Autotest":http://github.com/aslakhellesoy/cucumber/wikis/autotest-integration | |
595 | +support and how multiline strings work in feature files: | |
596 | + | |
597 | + # In your .feature file | |
598 | + Then I should see | |
599 | + """ | |
600 | + A string | |
601 | + that "indents" | |
602 | + and spans | |
603 | + several lines | |
604 | + | |
605 | + """ | |
606 | + | |
607 | + # In your steps.rb file | |
608 | + Then 'I should see' do |text| | |
609 | + text.should == "A string\n that \"indents\"\nand spans\nseveral lines\n" | |
610 | + end | |
611 | + | |
612 | +The triple quotes are used to define the start and end of a string, and it also defines what gets stripped away | |
613 | +in the inside string. If the triple quotes are indented 4 spaces, then the text within will have the 4 first | |
614 | +spaces removed too. | |
615 | + | |
616 | +=== New features | |
617 | +* Added --[no-]color option to force color on or off (Peter Jaros) | |
618 | +* Step definition without a block will be treated as pending (#64 Joseph Wilk) | |
619 | +* Added support for Welsh (improvements welcome) (Joseph Wilk) | |
620 | +* Added --quiet option to hide all development aid output when using Pretty formatter (#69 Joseph Wilk) | |
621 | +* Added --no-snippets option to hide snippets for pending steps when using Pretty formatter (#69 Joseph Wilk) | |
622 | +* Added error messages concerning cucumber.yml. (#70 Ben Mabey) | |
623 | +* Added Autotest support - work in progress... (Peter Jaros) | |
624 | +* Added new --exclude option (Bryan Helkamp) | |
625 | +* Added new --scenario option (Peter Jaros) | |
626 | +* Renamed common_webrat.rb to webrat_steps.rb (Ben Mabey, Aslak Hellesøy) | |
627 | +* Added new feature[:feature_path] task (Roman Gonzalez) | |
628 | +* Added support for Polish (Joseph Wilk) | |
629 | +* Support specifying multiple formatters and multiple outputs (#47 Joseph Wilk) | |
630 | +* Added support for Japanese. (Kakutani Shintaro) | |
631 | +* Added support for Texan (improvements welcome). (Aslak Hellesøy) | |
632 | + | |
633 | +=== Bugfixes | |
634 | +* Pending step snippets should escape special Regexp characters (#82 Joseph Wilk) | |
635 | +* Scenario without a body shouldn't show up as complete (#63 Josh Knowles) | |
636 | +* Fixed bug where utf-8 strings where breaking comment alighments. (#79 Joseph Wilk) | |
637 | +* Fixed next_column_index not resetting after large tables (#60, Barry Mitchelson) | |
638 | +* The HTML formatter was rendering everything twice. Cannot invoke visit_feature on formatters in executor (#72 Joseph Wilk) | |
639 | +* Row Scenarios need to support pending? in order for the Profile formatter to work (Joseph Wilk) | |
640 | +* Snippets are not shown for steps which already have a step definition (#65 Joseph Wilk) | |
641 | +* Prevent feature/scenario/pending step comments from containing '//' when running features by specifying a directory with a trailing '/' (Joseph Wilk) | |
642 | +* Scenario tables need spacing after them (#59 Joseph Wilk) | |
643 | +* Support running scenario table rows when using --line argument (#55 Joseph Wilk) | |
644 | +* Don't load cucumber.yml unless it exists (Aslak Hellesøy) | |
645 | +* Fixing bug where specifying line number 1 in a feature which starts with a scenario with a scenario table was raising an error (#56 Joseph Wilk) | |
646 | + | |
647 | +=== Removed features | |
648 | + | |
649 | + | |
650 | +== 0.1.8 2008-10-18 | |
651 | + | |
652 | +This release extends the support for tables. PLEASE NOTE THAT TABLES ARE STILL EXPERIMENTAL. | |
653 | +In previous releases it has been possible to use tables to define "more examples" of a scenario i | |
654 | +n a FIT-style column fixture kind of way. Now you can also use tables as arguments to steps. | |
655 | + | |
656 | +Tables used to define more examples after a scenario must now be prefixed. In English it looks like this: | |
657 | + | |
658 | + Feature: Addition | |
659 | + In order to avoid silly mistakes | |
660 | + As a math idiot | |
661 | + I want to be told the sum of two numbers | |
662 | + | |
663 | + Scenario: Add two numbers | |
664 | + Given I have entered 50 into the calculator | |
665 | + And I have entered 70 into the calculator | |
666 | + When I press add | |
667 | + Then the result should be 120 on the screen | |
668 | + | |
669 | + More Examples: | |
670 | + | input_1 | input_2 | button | output | | |
671 | + | 20 | 30 | add | 50 | | |
672 | + | 2 | 5 | add | 7 | | |
673 | + | 0 | 40 | add | 40 | | |
674 | + | |
675 | +Languages that are not updated yet will have to use "More Examples" until we get the translations. | |
676 | + | |
677 | +Tables can also be used as arguments to individual steps. In fact, steps now support a single argument | |
678 | +that can span several lines. This can be a table or a string. | |
679 | + | |
680 | +Example: | |
681 | + | |
682 | + Given the following people exist: | |
683 | + | name | email | phone | | |
684 | + | Aslak | aslak@email.com | 123 | | |
685 | + | Joe | joe@email.com | 234 | | |
686 | + | Bryan | bryan@email.org | 456 | | |
687 | + When I search for email.com | |
688 | + Then I should see: | |
689 | + | name | email | phone | | |
690 | + | Aslak | aslak@email.com | 123 | | |
691 | + | Joe | joe@email.com | 234 | | |
692 | + And I should see: | |
693 | + "Some text | |
694 | + on several lines" | |
695 | + | |
696 | +The step definitions for such multiline steps must define an extra block argument for the argument: | |
697 | + | |
698 | + Given /the following people exist:/ do |people_table| | |
699 | + # people_table is of type Cucumber::Model::Table | |
700 | + # See RDoc for more info | |
701 | + end | |
702 | + | |
703 | + Then /I should see:/ do |string| | |
704 | + # string is a plain old ruby String with leading spaces on each line removed | |
705 | + end | |
706 | + | |
707 | +=== New features | |
708 | +* Added profile formatter. (#35, Joseph Wilk) | |
709 | +* Added support for Chinese Simplified. (Liming Lian) | |
710 | +* Added support for Dutch. (Sjoerd Tieleman) | |
711 | +* Multiline steps are now supported. (#4, Aslak Hellesøy) | |
712 | +* Tables used to define more examples for a scenario must be prefixed "More Examples" (see languages.yml for other languages) | |
713 | +* Show the file and line number for scenarios as a comment when displaying with the pretty formatter. (#40, Joseph Wilk) | |
714 | +* Show the file for the feature as a comment when displaying with the pretty formatter. (#40, Joseph Wilk) | |
715 | +* Show the feature file and line for pending steps as a comment when displaying with the pretty formatter. (#40, Joseph Wilk) | |
716 | + | |
717 | +=== Bugfixes | |
718 | +* Fixed speling errors in Spanish (Daniel Cadenas) | |
719 | +* ActionMailer delivery_method should not be set to test (#41, Luke Melia) | |
720 | +* Reverse incorrectly ordered args in webrat select step (#43, David Chelimsky) | |
721 | +* Support comments above the first scenario (#31, Aslak Hellesøy) | |
722 | +* Fixed the HTML Formatter to use actual values for FIT table headers (#30, Joseph Wilk) | |
723 | + | |
724 | +=== Removed features | |
725 | +* Removed the /^I go to (.*)$/ step from common_webrat.rb - it's not language agnostic and provides little value. | |
726 | + | |
727 | +=== New features | |
728 | +* Added new --out option to make it easier to specify output from Rake and cucumber.yml | |
729 | + | |
730 | +== 0.1.7 2008-10-05 | |
731 | + | |
732 | +This release fixes a few bugs and adds some new features. The most notable features are: | |
733 | + | |
734 | +=== Calling steps from steps | |
735 | + | |
736 | +Step definitions are a little bit closer to having regular method semantics. | |
737 | +You define them, but now you can also call them from other steps. Here is an | |
738 | +example: | |
739 | + | |
740 | + Given /I am logged in as an (.*) named (.*)$/ do |role, name| | |
741 | + Given "I am registered as #{role}, #{name}, secret" | |
742 | + When "I log in with #{name}, secret" | |
743 | + end | |
744 | + | |
745 | + Given /I am registered as (.*), (.*), (.*)/ do |role, name, password| | |
746 | + # (Code removed for brevity) | |
747 | + end | |
748 | + | |
749 | + When /I log in with (.*), (.*)/ do |name, password| | |
750 | + # (Code removed for brevity) | |
751 | + end | |
752 | + | |
753 | +This means that steps can be reused in other steps. The GivenScenario feature achieves a similar | |
754 | +effect (on the scenario level), but this feature is something we're not very happy with, mostly | |
755 | +because it's not parameterisable. Calling steps from steps is. | |
756 | + | |
757 | +GivenScenario will still be working several releases, but the plan is to remove it completely in | |
758 | +the 0.3.0 release. | |
759 | + | |
760 | +=== Seeing where a step is defined | |
761 | + | |
762 | +Prior to this release it could be hard to find out where the ruby step definition matching | |
763 | +a plain text step is defined. Not anymore! Cucumber will now output this: | |
764 | + | |
765 | + Scenario: Regular numbers | |
766 | + Given I have entered 3 into the calculator # features/steps/calculator_steps.rb:12 | |
767 | + And I have entered 2 into the calculator # features/steps/calculator_steps.rb:12 | |
768 | + When I press divide # features/steps/calculator_steps.rb:16 | |
769 | + Then the result should be 1.5 on the screen # features/steps/calculator_steps.rb:20 | |
770 | + And the result class should be Float # features/steps/calculator_steps.rb:24 | |
771 | + | |
772 | +=== Bugfixes | |
773 | +* Fixed a bug in the command line args being lost when using --profile (#27, Joseph Wilk) | |
774 | +* Fixed a bug in Webrat selects (Tim Glen) | |
775 | +* Fixed parsing of DOS line endings (#2, #28, Aslak Hellesøy) | |
776 | + | |
777 | +=== New features | |
778 | +* Steps can be called from other steps (#3, Bryan Helmkamp, Aslak Hellesøy) | |
779 | +* Added But keyword to all languages (#21, Aslak Hellesøy) | |
780 | +* Added --no-source option to display step definition location next to step text (#26, Joseph Wilk, Aslak Hellesøy) | |
781 | +* Added more Webrat steps (#25, Tim Glen) | |
782 | + | |
783 | +== 0.1.6 2008-10-01 | |
784 | + | |
785 | +First gem release! | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +Copyright (c) 2008,2009 Aslak Hellesøy | |
2 | + | |
3 | +Permission is hereby granted, free of charge, to any person obtaining | |
4 | +a copy of this software and associated documentation files (the | |
5 | +"Software"), to deal in the Software without restriction, including | |
6 | +without limitation the rights to use, copy, modify, merge, publish, | |
7 | +distribute, sublicense, and/or sell copies of the Software, and to | |
8 | +permit persons to whom the Software is furnished to do so, subject to | |
9 | +the following conditions: | |
10 | + | |
11 | +The above copyright notice and this permission notice shall be | |
12 | +included in all copies or substantial portions of the Software. | |
13 | + | |
14 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
15 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
16 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
17 | +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
18 | +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
19 | +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
20 | +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
0 | 21 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,405 @@ |
1 | +History.txt | |
2 | +License.txt | |
3 | +Manifest.txt | |
4 | +README.txt | |
5 | +Rakefile | |
6 | +bin/cucumber | |
7 | +config/hoe.rb | |
8 | +config/requirements.rb | |
9 | +cucumber.yml | |
10 | +examples/cs/README.textile | |
11 | +examples/cs/Rakefile | |
12 | +examples/cs/compile.bat | |
13 | +examples/cs/features/addition.feature | |
14 | +examples/cs/features/step_definitons/calculator_steps.rb | |
15 | +examples/cs/src/demo/Calculator.cs | |
16 | +examples/dos_line_endings/Rakefile | |
17 | +examples/dos_line_endings/features/dos_line_endings.feature | |
18 | +examples/i18n/README.textile | |
19 | +examples/i18n/Rakefile | |
20 | +examples/i18n/ar/Rakefile | |
21 | +examples/i18n/ar/features/addition.feature | |
22 | +examples/i18n/ar/features/step_definitons/calculator_steps.rb | |
23 | +examples/i18n/ar/lib/calculator.rb | |
24 | +examples/i18n/bg/Rakefile | |
25 | +examples/i18n/bg/features/addition.feature | |
26 | +examples/i18n/bg/features/consecutive_calculations.feature | |
27 | +examples/i18n/bg/features/division.feature | |
28 | +examples/i18n/bg/features/step_definitons/calculator_steps.rb | |
29 | +examples/i18n/bg/features/support/env.rb | |
30 | +examples/i18n/bg/features/support/world.rb | |
31 | +examples/i18n/bg/lib/calculator.rb | |
32 | +examples/i18n/cat/Rakefile | |
33 | +examples/i18n/cat/features/step_definitons/calculator_steps.rb | |
34 | +examples/i18n/cat/features/suma.feature | |
35 | +examples/i18n/cat/lib/calculadora.rb | |
36 | +examples/i18n/da/Rakefile | |
37 | +examples/i18n/da/features/step_definitons/kalkulator_steps.rb | |
38 | +examples/i18n/da/features/summering.feature | |
39 | +examples/i18n/da/lib/kalkulator.rb | |
40 | +examples/i18n/de/Rakefile | |
41 | +examples/i18n/de/features/addition.feature | |
42 | +examples/i18n/de/features/division.feature | |
43 | +examples/i18n/de/features/step_definitons/calculator_steps.rb | |
44 | +examples/i18n/de/lib/calculator.rb | |
45 | +examples/i18n/en-lol/Rakefile | |
46 | +examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb | |
47 | +examples/i18n/en-lol/features/stuffing.feature | |
48 | +examples/i18n/en-lol/features/support/env.rb | |
49 | +examples/i18n/en-lol/lib/basket.rb | |
50 | +examples/i18n/en-lol/lib/belly.rb | |
51 | +examples/i18n/en/Rakefile | |
52 | +examples/i18n/en/features/addition.feature | |
53 | +examples/i18n/en/features/division.feature | |
54 | +examples/i18n/en/features/step_definitons/calculator_steps.rb | |
55 | +examples/i18n/en/lib/calculator.rb | |
56 | +examples/i18n/es/Rakefile | |
57 | +examples/i18n/es/features/adicion.feature | |
58 | +examples/i18n/es/features/step_definitons/calculador_steps.rb | |
59 | +examples/i18n/es/lib/calculador.rb | |
60 | +examples/i18n/et/Rakefile | |
61 | +examples/i18n/et/features/jagamine.feature | |
62 | +examples/i18n/et/features/liitmine.feature | |
63 | +examples/i18n/et/features/step_definitions/kalkulaator_steps.rb | |
64 | +examples/i18n/et/lib/kalkulaator.rb | |
65 | +examples/i18n/fi/Rakefile | |
66 | +examples/i18n/fi/features/jakolasku.feature | |
67 | +examples/i18n/fi/features/step_definitons/laskin_steps.rb | |
68 | +examples/i18n/fi/features/yhteenlasku.feature | |
69 | +examples/i18n/fi/lib/laskin.rb | |
70 | +examples/i18n/fr/Rakefile | |
71 | +examples/i18n/fr/features/addition.feature | |
72 | +examples/i18n/fr/features/step_definitions/calculatrice_steps.rb | |
73 | +examples/i18n/fr/lib/calculatrice.rb | |
74 | +examples/i18n/he/Rakefile | |
75 | +examples/i18n/he/features/addition.feature | |
76 | +examples/i18n/he/features/division.feature | |
77 | +examples/i18n/he/features/step_definitons/calculator_steps.rb | |
78 | +examples/i18n/he/lib/calculator.rb | |
79 | +examples/i18n/hu/Rakefile | |
80 | +examples/i18n/hu/features/addition.feature | |
81 | +examples/i18n/hu/features/division.feature | |
82 | +examples/i18n/hu/features/step_definitons/calculator_steps.rb | |
83 | +examples/i18n/hu/lib/calculator.rb | |
84 | +examples/i18n/id/Rakefile | |
85 | +examples/i18n/id/features/addition.feature | |
86 | +examples/i18n/id/features/division.feature | |
87 | +examples/i18n/id/features/step_definitons/calculator_steps.rb | |
88 | +examples/i18n/id/lib/calculator.rb | |
89 | +examples/i18n/it/Rakefile | |
90 | +examples/i18n/it/features/somma.feature | |
91 | +examples/i18n/it/features/step_definitons/calcolatrice_steps.rb | |
92 | +examples/i18n/it/lib/calcolatrice.rb | |
93 | +examples/i18n/ja/Rakefile | |
94 | +examples/i18n/ja/features/addition.feature | |
95 | +examples/i18n/ja/features/division.feature | |
96 | +examples/i18n/ja/features/step_definitons/calculator_steps.rb | |
97 | +examples/i18n/ja/lib/calculator.rb | |
98 | +examples/i18n/ko/Rakefile | |
99 | +examples/i18n/ko/features/addition.feature | |
100 | +examples/i18n/ko/features/division.feature | |
101 | +examples/i18n/ko/features/step_definitons/calculator_steps.rb | |
102 | +examples/i18n/ko/lib/calculator.rb | |
103 | +examples/i18n/lt/Rakefile | |
104 | +examples/i18n/lt/features/addition.feature | |
105 | +examples/i18n/lt/features/division.feature | |
106 | +examples/i18n/lt/features/step_definitons/calculator_steps.rb | |
107 | +examples/i18n/lt/lib/calculator.rb | |
108 | +examples/i18n/lv/Rakefile | |
109 | +examples/i18n/lv/features/addition.feature | |
110 | +examples/i18n/lv/features/division.feature | |
111 | +examples/i18n/lv/features/step_definitons/calculator_steps.rb | |
112 | +examples/i18n/lv/lib/calculator.rb | |
113 | +examples/i18n/no/Rakefile | |
114 | +examples/i18n/no/features/step_definitons/kalkulator_steps.rb | |
115 | +examples/i18n/no/features/summering.feature | |
116 | +examples/i18n/no/features/support/env.rb | |
117 | +examples/i18n/no/lib/kalkulator.rb | |
118 | +examples/i18n/pl/Rakefile | |
119 | +examples/i18n/pl/features/addition.feature | |
120 | +examples/i18n/pl/features/division.feature | |
121 | +examples/i18n/pl/features/step_definitons/calculator_steps.rb | |
122 | +examples/i18n/pl/features/support/env.rb | |
123 | +examples/i18n/pl/lib/calculator.rb | |
124 | +examples/i18n/pt/Rakefile | |
125 | +examples/i18n/pt/features/adicao.feature | |
126 | +examples/i18n/pt/features/step_definitions/calculadora_steps.rb | |
127 | +examples/i18n/pt/features/support/env.rb | |
128 | +examples/i18n/pt/lib/calculadora.rb | |
129 | +examples/i18n/ro/Rakefile | |
130 | +examples/i18n/ro/features/step_definitons/calculator_steps.rb | |
131 | +examples/i18n/ro/features/suma.feature | |
132 | +examples/i18n/ro/lib/calculator.rb | |
133 | +examples/i18n/ru/Rakefile | |
134 | +examples/i18n/ru/features/addition.feature | |
135 | +examples/i18n/ru/features/consecutive_calculations.feature | |
136 | +examples/i18n/ru/features/division.feature | |
137 | +examples/i18n/ru/features/step_definitons/calculator_steps.rb | |
138 | +examples/i18n/ru/features/support/env.rb | |
139 | +examples/i18n/ru/features/support/world.rb | |
140 | +examples/i18n/ru/lib/calculator.rb | |
141 | +examples/i18n/se/Rakefile | |
142 | +examples/i18n/se/features/step_definitons/kalkulator_steps.rb | |
143 | +examples/i18n/se/features/summering.feature | |
144 | +examples/i18n/se/lib/kalkulator.rb | |
145 | +examples/i18n/sk/Rakefile | |
146 | +examples/i18n/sk/features/addition.feature | |
147 | +examples/i18n/sk/features/division.feature | |
148 | +examples/i18n/sk/features/step_definitons/calculator_steps.rb | |
149 | +examples/i18n/sk/lib/calculator.rb | |
150 | +examples/i18n/zh-CN/Rakefile | |
151 | +examples/i18n/zh-CN/features/addition.feature | |
152 | +examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb | |
153 | +examples/i18n/zh-CN/lib/calculator.rb | |
154 | +examples/i18n/zh-TW/Rakefile | |
155 | +examples/i18n/zh-TW/features/addition.feature | |
156 | +examples/i18n/zh-TW/features/division.feature | |
157 | +examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb | |
158 | +examples/i18n/zh-TW/lib/calculator.rb | |
159 | +examples/java/README.textile | |
160 | +examples/java/build.xml | |
161 | +examples/java/features/hello.feature | |
162 | +examples/java/features/step_definitons/hello_steps.rb | |
163 | +examples/java/features/step_definitons/tree_steps.rb | |
164 | +examples/java/features/tree.feature | |
165 | +examples/java/src/cucumber/demo/Hello.java | |
166 | +examples/junit/features/one_passing_one_failing.feature | |
167 | +examples/junit/features/pending.feature | |
168 | +examples/junit/features/step_definitions/steps.rb | |
169 | +examples/pure_java/README.textile | |
170 | +examples/selenium/Rakefile | |
171 | +examples/selenium/features/search.feature | |
172 | +examples/selenium/features/step_definitons/search_steps.rb | |
173 | +examples/selenium/features/support/env.rb | |
174 | +examples/selenium_webrat/Rakefile | |
175 | +examples/selenium_webrat/config.ru | |
176 | +examples/selenium_webrat/features/search.feature | |
177 | +examples/selenium_webrat/features/step_definitons/search_steps.rb | |
178 | +examples/selenium_webrat/features/support/env.rb | |
179 | +examples/self_test/README.textile | |
180 | +examples/self_test/Rakefile | |
181 | +examples/self_test/features/background/background_tagged_before_on_outline.feature | |
182 | +examples/self_test/features/background/background_with_name.feature | |
183 | +examples/self_test/features/background/failing_background.feature | |
184 | +examples/self_test/features/background/failing_background_after_success.feature | |
185 | +examples/self_test/features/background/multiline_args_background.feature | |
186 | +examples/self_test/features/background/passing_background.feature | |
187 | +examples/self_test/features/background/pending_background.feature | |
188 | +examples/self_test/features/background/scenario_outline_failing_background.feature | |
189 | +examples/self_test/features/background/scenario_outline_passing_background.feature | |
190 | +examples/self_test/features/call_undefined_step_from_step_def.feature | |
191 | +examples/self_test/features/failing_expectation.feature | |
192 | +examples/self_test/features/lots_of_undefined.feature | |
193 | +examples/self_test/features/multiline_name.feature | |
194 | +examples/self_test/features/outline_sample.feature | |
195 | +examples/self_test/features/sample.feature | |
196 | +examples/self_test/features/search_sample.feature | |
197 | +examples/self_test/features/step_definitions/sample_steps.rb | |
198 | +examples/self_test/features/support/env.rb | |
199 | +examples/self_test/features/tons_of_cukes.feature | |
200 | +examples/self_test/features/undefined_multiline_args.feature | |
201 | +examples/sinatra/Rakefile | |
202 | +examples/sinatra/app.rb | |
203 | +examples/sinatra/features/add.feature | |
204 | +examples/sinatra/features/step_definitions/add_steps.rb | |
205 | +examples/sinatra/features/support/env.rb | |
206 | +examples/sinatra/views/add.erb | |
207 | +examples/sinatra/views/layout.erb | |
208 | +examples/test_unit/Rakefile | |
209 | +examples/test_unit/features/step_definitions/test_unit_steps.rb | |
210 | +examples/test_unit/features/test_unit.feature | |
211 | +examples/tickets/Rakefile | |
212 | +examples/tickets/features/172.feature | |
213 | +examples/tickets/features/177/1.feature | |
214 | +examples/tickets/features/177/2.feature | |
215 | +examples/tickets/features/177/3.feature | |
216 | +examples/tickets/features/180.feature | |
217 | +examples/tickets/features/229/tagged_hooks.feature | |
218 | +examples/tickets/features/229/tagged_hooks.rb | |
219 | +examples/tickets/features/236.feature | |
220 | +examples/tickets/features/241.feature | |
221 | +examples/tickets/features/246.feature | |
222 | +examples/tickets/features/248.feature | |
223 | +examples/tickets/features/270/back.feature | |
224 | +examples/tickets/features/270/back.steps.rb | |
225 | +examples/tickets/features/272/hooks.feature | |
226 | +examples/tickets/features/272/hooks_steps.rb | |
227 | +examples/tickets/features/279/py_string_indent.feature | |
228 | +examples/tickets/features/279/py_string_indent.steps.rb | |
229 | +examples/tickets/features/279/wrong.feature_ | |
230 | +examples/tickets/features/301/filter_background_tagged_hooks.feature | |
231 | +examples/tickets/features/301/filter_background_tagged_hooks_steps.rb | |
232 | +examples/tickets/features/306/only_background.feature | |
233 | +examples/tickets/features/lib/eatting_machine.rb | |
234 | +examples/tickets/features/lib/pantry.rb | |
235 | +examples/tickets/features/scenario_outline.feature | |
236 | +examples/tickets/features/step_definitons/246_steps.rb | |
237 | +examples/tickets/features/step_definitons/248_steps.rb | |
238 | +examples/tickets/features/step_definitons/scenario_outline_steps.rb | |
239 | +examples/tickets/features/step_definitons/tickets_steps.rb | |
240 | +examples/tickets/features/tickets.feature | |
241 | +examples/watir/README.textile | |
242 | +examples/watir/Rakefile | |
243 | +examples/watir/features/search.feature | |
244 | +examples/watir/features/step_definitons/search_steps.rb | |
245 | +examples/watir/features/support/env.rb | |
246 | +features/after_block_exceptions.feature | |
247 | +features/after_step_block_exceptions.feature | |
248 | +features/background.feature | |
249 | +features/cucumber_cli.feature | |
250 | +features/cucumber_cli_diff_disabled.feature | |
251 | +features/cucumber_cli_outlines.feature | |
252 | +features/custom_formatter.feature | |
253 | +features/drb_server_integration.feature | |
254 | +features/exclude_files.feature | |
255 | +features/expand.feature | |
256 | +features/html_formatter.feature | |
257 | +features/html_formatter/a.html | |
258 | +features/junit_formatter.feature | |
259 | +features/multiline_names.feature | |
260 | +features/rake_task.feature | |
261 | +features/report_called_undefined_steps.feature | |
262 | +features/snippet.feature | |
263 | +features/step_definitions/cucumber_steps.rb | |
264 | +features/step_definitions/extra_steps.rb | |
265 | +features/support/env.rb | |
266 | +features/usage.feature | |
267 | +features/work_in_progress.feature | |
268 | +gem_tasks/deployment.rake | |
269 | +gem_tasks/environment.rake | |
270 | +gem_tasks/features.rake | |
271 | +gem_tasks/fix_cr_lf.rake | |
272 | +gem_tasks/flog.rake | |
273 | +gem_tasks/gemspec.rake | |
274 | +gem_tasks/rspec.rake | |
275 | +gem_tasks/yard.rake | |
276 | +lib/autotest/cucumber.rb | |
277 | +lib/autotest/cucumber_mixin.rb | |
278 | +lib/autotest/cucumber_rails.rb | |
279 | +lib/autotest/cucumber_rails_rspec.rb | |
280 | +lib/autotest/cucumber_rspec.rb | |
281 | +lib/autotest/discover.rb | |
282 | +lib/cucumber.rb | |
283 | +lib/cucumber/ast.rb | |
284 | +lib/cucumber/ast/background.rb | |
285 | +lib/cucumber/ast/comment.rb | |
286 | +lib/cucumber/ast/examples.rb | |
287 | +lib/cucumber/ast/feature.rb | |
288 | +lib/cucumber/ast/feature_element.rb | |
289 | +lib/cucumber/ast/features.rb | |
290 | +lib/cucumber/ast/outline_table.rb | |
291 | +lib/cucumber/ast/py_string.rb | |
292 | +lib/cucumber/ast/scenario.rb | |
293 | +lib/cucumber/ast/scenario_outline.rb | |
294 | +lib/cucumber/ast/step.rb | |
295 | +lib/cucumber/ast/step_collection.rb | |
296 | +lib/cucumber/ast/step_invocation.rb | |
297 | +lib/cucumber/ast/table.rb | |
298 | +lib/cucumber/ast/tags.rb | |
299 | +lib/cucumber/ast/visitor.rb | |
300 | +lib/cucumber/broadcaster.rb | |
301 | +lib/cucumber/cli/configuration.rb | |
302 | +lib/cucumber/cli/drb_client.rb | |
303 | +lib/cucumber/cli/language_help_formatter.rb | |
304 | +lib/cucumber/cli/main.rb | |
305 | +lib/cucumber/core_ext/exception.rb | |
306 | +lib/cucumber/core_ext/instance_exec.rb | |
307 | +lib/cucumber/core_ext/proc.rb | |
308 | +lib/cucumber/core_ext/string.rb | |
309 | +lib/cucumber/formatter/ansicolor.rb | |
310 | +lib/cucumber/formatter/color_io.rb | |
311 | +lib/cucumber/formatter/console.rb | |
312 | +lib/cucumber/formatter/cucumber.css | |
313 | +lib/cucumber/formatter/cucumber.sass | |
314 | +lib/cucumber/formatter/duration.rb | |
315 | +lib/cucumber/formatter/html.rb | |
316 | +lib/cucumber/formatter/junit.rb | |
317 | +lib/cucumber/formatter/pretty.rb | |
318 | +lib/cucumber/formatter/profile.rb | |
319 | +lib/cucumber/formatter/progress.rb | |
320 | +lib/cucumber/formatter/rerun.rb | |
321 | +lib/cucumber/formatter/tag_cloud.rb | |
322 | +lib/cucumber/formatter/unicode.rb | |
323 | +lib/cucumber/formatter/usage.rb | |
324 | +lib/cucumber/formatters/unicode.rb | |
325 | +lib/cucumber/languages.yml | |
326 | +lib/cucumber/parser.rb | |
327 | +lib/cucumber/parser/feature.rb | |
328 | +lib/cucumber/parser/feature.tt | |
329 | +lib/cucumber/parser/i18n.tt | |
330 | +lib/cucumber/parser/table.rb | |
331 | +lib/cucumber/parser/table.tt | |
332 | +lib/cucumber/parser/treetop_ext.rb | |
333 | +lib/cucumber/platform.rb | |
334 | +lib/cucumber/rails/rspec.rb | |
335 | +lib/cucumber/rails/world.rb | |
336 | +lib/cucumber/rake/task.rb | |
337 | +lib/cucumber/rspec_neuter.rb | |
338 | +lib/cucumber/step_definition.rb | |
339 | +lib/cucumber/step_match.rb | |
340 | +lib/cucumber/step_mother.rb | |
341 | +lib/cucumber/version.rb | |
342 | +lib/cucumber/world.rb | |
343 | +rails_generators/cucumber/USAGE | |
344 | +rails_generators/cucumber/cucumber_generator.rb | |
345 | +rails_generators/cucumber/templates/cucumber | |
346 | +rails_generators/cucumber/templates/cucumber.rake | |
347 | +rails_generators/cucumber/templates/cucumber_environment.rb | |
348 | +rails_generators/cucumber/templates/env.rb | |
349 | +rails_generators/cucumber/templates/paths.rb | |
350 | +rails_generators/cucumber/templates/spork_env.rb | |
351 | +rails_generators/cucumber/templates/webrat_steps.rb | |
352 | +rails_generators/feature/USAGE | |
353 | +rails_generators/feature/feature_generator.rb | |
354 | +rails_generators/feature/templates/feature.erb | |
355 | +rails_generators/feature/templates/steps.erb | |
356 | +spec/cucumber/ast/background_spec.rb | |
357 | +spec/cucumber/ast/feature_element_spec.rb | |
358 | +spec/cucumber/ast/feature_factory.rb | |
359 | +spec/cucumber/ast/feature_spec.rb | |
360 | +spec/cucumber/ast/py_string_spec.rb | |
361 | +spec/cucumber/ast/scenario_outline_spec.rb | |
362 | +spec/cucumber/ast/scenario_spec.rb | |
363 | +spec/cucumber/ast/step_collection_spec.rb | |
364 | +spec/cucumber/ast/step_spec.rb | |
365 | +spec/cucumber/ast/table_spec.rb | |
366 | +spec/cucumber/ast/visitor_spec.rb | |
367 | +spec/cucumber/broadcaster_spec.rb | |
368 | +spec/cucumber/cli/configuration_spec.rb | |
369 | +spec/cucumber/cli/drb_client_spec.rb | |
370 | +spec/cucumber/cli/main_spec.rb | |
371 | +spec/cucumber/core_ext/proc_spec.rb | |
372 | +spec/cucumber/core_ext/string_spec.rb | |
373 | +spec/cucumber/formatter/ansicolor_spec.rb | |
374 | +spec/cucumber/formatter/color_io_spec.rb | |
375 | +spec/cucumber/formatter/duration_spec.rb | |
376 | +spec/cucumber/formatter/html/cucumber.css | |
377 | +spec/cucumber/formatter/html/cucumber.js | |
378 | +spec/cucumber/formatter/html/index.html | |
379 | +spec/cucumber/formatter/html/jquery-1.3.min.js | |
380 | +spec/cucumber/formatter/html/jquery.uitableedit.js | |
381 | +spec/cucumber/formatter/progress_spec.rb | |
382 | +spec/cucumber/parser/feature_parser_spec.rb | |
383 | +spec/cucumber/parser/table_parser_spec.rb | |
384 | +spec/cucumber/rails/stubs/mini_rails.rb | |
385 | +spec/cucumber/rails/stubs/test_help.rb | |
386 | +spec/cucumber/rails/world_spec.rb | |
387 | +spec/cucumber/sell_cucumbers.feature | |
388 | +spec/cucumber/step_definition_spec.rb | |
389 | +spec/cucumber/step_mother_spec.rb | |
390 | +spec/cucumber/treetop_parser/empty_feature.feature | |
391 | +spec/cucumber/treetop_parser/empty_scenario.feature | |
392 | +spec/cucumber/treetop_parser/empty_scenario_outline.feature | |
393 | +spec/cucumber/treetop_parser/fit_scenario.feature | |
394 | +spec/cucumber/treetop_parser/given_scenario.feature | |
395 | +spec/cucumber/treetop_parser/invalid_scenario_outlines.feature | |
396 | +spec/cucumber/treetop_parser/multiline_steps.feature | |
397 | +spec/cucumber/treetop_parser/multiple_tables.feature | |
398 | +spec/cucumber/treetop_parser/scenario_outline.feature | |
399 | +spec/cucumber/treetop_parser/spaces.feature | |
400 | +spec/cucumber/treetop_parser/test_dos.feature | |
401 | +spec/cucumber/treetop_parser/with_comments.feature | |
402 | +spec/cucumber/treetop_parser/with_tags.feature | |
403 | +spec/cucumber/world/pending_spec.rb | |
404 | +spec/spec.opts | |
405 | +spec/spec_helper.rb | ... | ... |
... | ... | @@ -0,0 +1,9 @@ |
1 | +ENV['NODOT'] = 'true' # We don't want class diagrams in RDoc | |
2 | +require 'config/requirements' | |
3 | +require 'config/hoe' # setup Hoe + all gem configuration | |
4 | + | |
5 | +Dir['gem_tasks/**/*.rake'].each { |rake| load rake } | |
6 | + | |
7 | +# Hoe gives us :default => :test, but we don't have Test::Unit tests. | |
8 | +Rake::Task[:default].clear_prerequisites rescue nil # For some super weird reason this fails for some... | |
9 | +task :default => [:spec, :features] | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +#!/usr/bin/env ruby | |
2 | +# Add '.rb' to work around a bug in IronRuby's File#dirname | |
3 | +$:.unshift(File.dirname(__FILE__ + '.rb') + '/../lib') unless $:.include?(File.dirname(__FILE__ + '.rb') + '/../lib') | |
4 | + | |
5 | +require 'cucumber/rspec_neuter' | |
6 | +require 'cucumber/cli/main' | |
7 | +begin | |
8 | + # The dup is to keep ARGV intact, so that tools like ruby-debug can respawn. | |
9 | + failure = Cucumber::Cli::Main.execute(ARGV.dup) | |
10 | + Kernel.exit(failure ? 1 : 0) | |
11 | +rescue SystemExit => e | |
12 | + Kernel.exit(e.status) | |
13 | +rescue Exception => e | |
14 | + STDERR.puts("#{e.message} (#{e.class})") | |
15 | + STDERR.puts(e.backtrace.join("\n")) | |
16 | + Kernel.exit 1 | |
17 | +end | |
0 | 18 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,77 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'cucumber/version' | |
3 | + | |
4 | +AUTHOR = 'Aslak Hellesøy' # can also be an array of Authors | |
5 | +EMAIL = "aslak.hellesoy@gmail.com" | |
6 | +DESCRIPTION = "Executable Feature scenarios" | |
7 | +GEM_NAME = 'cucumber' # what ppl will type to install your gem | |
8 | +HOMEPATH = "http://cukes.info" | |
9 | +RUBYFORGE_PROJECT = 'rspec' | |
10 | + | |
11 | +@config_file = "~/.rubyforge/user-config.yml" | |
12 | +@config = nil | |
13 | +RUBYFORGE_USERNAME = "aslak_hellesoy" | |
14 | +def rubyforge_username | |
15 | + unless @config | |
16 | + begin | |
17 | + @config = YAML.load(File.read(File.expand_path(@config_file))) | |
18 | + rescue | |
19 | + puts <<-EOS | |
20 | +ERROR: No rubyforge config file found: #{@config_file} | |
21 | +Run 'rubyforge setup' to prepare your env for access to Rubyforge | |
22 | + - See http://newgem.rubyforge.org/rubyforge.html for more details | |
23 | + EOS | |
24 | + exit | |
25 | + end | |
26 | + end | |
27 | + RUBYFORGE_USERNAME.replace @config["username"] | |
28 | +end | |
29 | + | |
30 | + | |
31 | +REV = nil | |
32 | +# UNCOMMENT IF REQUIRED: | |
33 | +# REV = YAML.load(`svn info`)['Revision'] | |
34 | +VERS = Cucumber::VERSION::STRING + (REV ? ".#{REV}" : "") | |
35 | +RDOC_OPTS = ['--quiet', '--title', 'Cucumber documentation', | |
36 | + "--opname", "index.html", | |
37 | + "--line-numbers", | |
38 | + "--main", "README.textile", | |
39 | + "--inline-source"] | |
40 | + | |
41 | +# Remove Hoe dependency | |
42 | +class Hoe | |
43 | + def extra_dev_deps | |
44 | + @extra_dev_deps.reject! { |dep| dep[0] == "hoe" } | |
45 | + @extra_dev_deps | |
46 | + end | |
47 | +end | |
48 | + | |
49 | +# Generate all the Rake tasks | |
50 | +# Run 'rake -T' to see list of generated tasks (from gem root directory) | |
51 | +$hoe = Hoe.new(GEM_NAME, VERS) do |p| | |
52 | + p.developer(AUTHOR, EMAIL) | |
53 | + p.description = DESCRIPTION | |
54 | + p.summary = DESCRIPTION | |
55 | + p.url = HOMEPATH | |
56 | + p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT | |
57 | + p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', '**/*.class', '**/*.jar', '**/tmp'] #An array of file patterns to delete on clean. | |
58 | + | |
59 | + # == Optional | |
60 | + p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n") | |
61 | + #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ] | |
62 | + p.extra_deps = [ | |
63 | + ['term-ansicolor', '>= 1.0.3'], | |
64 | + ['treetop', '>= 1.2.5'], | |
65 | + ['polyglot', '>= 0.2.5'], # Remove this when Treetop no longer loads polyglot by default. | |
66 | + ['diff-lcs', '>= 1.1.2'], | |
67 | + ['builder', '>= 2.1.2'] | |
68 | + ] | |
69 | + | |
70 | + #p.spec_extras = {} # A hash of extra values to set in the gemspec. | |
71 | + | |
72 | +end | |
73 | + | |
74 | +CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n") | |
75 | +PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}" | |
76 | +$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc') | |
77 | +$hoe.rsync_args = '-av --delete --ignore-errors' | |
0 | 78 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +require 'fileutils' | |
2 | +include FileUtils | |
3 | + | |
4 | +require 'rubygems' | |
5 | +%w[rake hoe].each do |req_gem| | |
6 | + begin | |
7 | + require req_gem | |
8 | + rescue LoadError | |
9 | + puts "This Rakefile requires the '#{req_gem}' RubyGem." | |
10 | + puts "Installation: gem install #{req_gem} -y" | |
11 | + exit | |
12 | + end | |
13 | +end | |
14 | + | |
15 | +$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib])) | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +default: --format progress features --tags ~@proposed,~@in_progress | ... | ... |
... | ... | @@ -0,0 +1,12 @@ |
1 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') | |
2 | +require 'cucumber/rake/task' | |
3 | + | |
4 | +Cucumber::Rake::Task.new(:features) do |t| | |
5 | + t.cucumber_opts = %w{--format pretty} | |
6 | +end | |
7 | + | |
8 | +task :features => :compile | |
9 | + | |
10 | +task :compile do | |
11 | + sh "csc /target:library /out:Demo.dll src\\demo\\Calculator.cs" | |
12 | +end | |
0 | 13 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/cs/features/addition.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Feature: Addition | |
2 | + In order to avoid silly mistakes | |
3 | + As a math idiot | |
4 | + I want to be told the sum of two numbers | |
5 | + | |
6 | + Scenario Outline: Add two numbers | |
7 | + Given I have entered <input_1> into the calculator | |
8 | + And I have entered <input_2> into the calculator | |
9 | + When I press add | |
10 | + Then the result should be <output> on the screen | |
11 | + | |
12 | + Examples: | |
13 | + | input_1 | input_2 | output | | |
14 | + | 20 | 30 | 50 | | |
15 | + | 2 | 5 | 7 | | |
16 | + | 0 | 40 | 40 | | ... | ... |
vendor/gems/cucumber-0.3.11/examples/cs/features/step_definitons/calculator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,19 @@ |
1 | +require 'spec/expectations' | |
2 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
3 | +require 'Calculator' # Calculator.dll | |
4 | + | |
5 | +Before do | |
6 | + @calc = Demo::Calculator.new # A .NET class in Calculator.dll | |
7 | +end | |
8 | + | |
9 | +Given "I have entered $n into the calculator" do |n| | |
10 | + @calc.push n.to_i | |
11 | +end | |
12 | + | |
13 | +When /I press add/ do | |
14 | + @result = @calc.Add | |
15 | +end | |
16 | + | |
17 | +Then /the result should be (.*) on the screen/ do |result| | |
18 | + @result.should == result.to_i | |
19 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/cs/src/demo/Calculator.cs
0 → 100644
... | ... | @@ -0,0 +1,20 @@ |
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | + | |
4 | +namespace Demo { | |
5 | + public class Calculator { | |
6 | + private List<int>args = new List<int>(); | |
7 | + | |
8 | + public void Push(int n) { | |
9 | + args.Add(n); | |
10 | + } | |
11 | + | |
12 | + public int Add() { | |
13 | + int result = 0; | |
14 | + foreach(int n in args) { | |
15 | + result += n; | |
16 | + } | |
17 | + return result; | |
18 | + } | |
19 | + } | |
20 | +} | ... | ... |
vendor/gems/cucumber-0.3.11/examples/dos_line_endings/Rakefile
0 → 100644
vendor/gems/cucumber-0.3.11/examples/dos_line_endings/features/dos_line_endings.feature
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +Feature: DOS line endings | |
2 | + In order to have less bug reports | |
3 | + As a windows developer | |
4 | + I want to write features with DOS line endigs | |
5 | + | |
6 | + Scenario: Just lots of DOS | |
7 | + Given I am on DOS | |
8 | + And Any version of Windows is really just DOS | |
9 | + Then Windows still sucks | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/README.textile
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | +h1. Internationalisation (i18n) examples | |
2 | + | |
3 | +Under this directory you'll find examples of Cucumber features written in | |
4 | +many of the natural languages Cucumber supports. | |
5 | + | |
6 | +For a full list of what languages Cucumber supports - run <pre>cucumber --language help</pre> | |
7 | + | |
8 | +h2. Running all the examples | |
9 | + | |
10 | +Open a shell in this directory and run | |
11 | + | |
12 | +<pre>rake i18n</pre> | |
13 | + | |
14 | +h2. Running examples for a specific language | |
15 | + | |
16 | +Open a shell in the directory for the specific language and run | |
17 | + | |
18 | +<pre>rake features</pre> | |
0 | 19 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +desc 'Run features for all languages' | |
2 | +task :i18n do | |
3 | + dir = File.dirname(__FILE__) | |
4 | + Dir["#{dir}/*"].each do |f| | |
5 | + if File.directory?(f) | |
6 | + lang = f[dir.length+1..-1] | |
7 | + if examples_working?(lang) | |
8 | + Dir.chdir(f) do | |
9 | + rake("features") | |
10 | + end | |
11 | + else | |
12 | + STDERR.puts %{ | |
13 | +!!!!! | |
14 | +!!!!! | |
15 | +!!!!! SKIPPING #{lang} (The examples are out of date - please help update them) | |
16 | +!!!!! | |
17 | +!!!!! | |
18 | +} | |
19 | + end | |
20 | + end | |
21 | + end | |
22 | +end | |
23 | + | |
24 | +def examples_working?(lang) | |
25 | + !%w{ro ko li lt}.index(lang) | |
26 | +end | |
27 | + | |
28 | +def rake(args) | |
29 | + ruby($0, args) rescue nil | |
30 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/ar/features/addition.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +خاصية: الجمع | |
2 | + من اجل تجنب الأخطاء السخيفة | |
3 | + كشخص غبي في الرياضيات | |
4 | + اريد معرفة ناتج جمع عددين | |
5 | + | |
6 | + سيناريو مخطط: جمع عددين | |
7 | + بفرض كتابة <input_1> في الآلة الحاسبة | |
8 | + و كتابة <input_2> في الآلة الحاسبة | |
9 | + متى يتم الضغط على <button> | |
10 | + اذاً يظهر <output> على الشاشة | |
11 | + | |
12 | + امثلة: | |
13 | + | input_1 | input_2 | button | output | | |
14 | + | 20 | 30 | جمع | 50 | | |
15 | + | 2 | 5 | جمع | 7 | | |
16 | + | 0 | 40 | جمع | 40 | | |
0 | 17 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/ar/features/step_definitons/calculator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'calculator' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Calculator.new | |
9 | +end | |
10 | + | |
11 | +After do | |
12 | +end | |
13 | + | |
14 | +Given "كتابة $n في الآلة الحاسبة" do |n| | |
15 | + @calc.push n.to_i | |
16 | +end | |
17 | + | |
18 | +When /يتم الضغط على (\w+)/ do |op| | |
19 | + @result = @calc.send op | |
20 | +end | |
21 | + | |
22 | +Then /يظهر (.*) على الشاشة/ do |result| | |
23 | + @result.should == result.to_f | |
24 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/ar/lib/calculator.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/bg/features/addition.feature
0 → 100644
... | ... | @@ -0,0 +1,11 @@ |
1 | +Функционалност: Събиране на числа | |
2 | + За да не го правят наум | |
3 | + Потребителите | |
4 | + Трябва да могат да събират числа с калкулатора | |
5 | + | |
6 | + Сценарий: Събиране на две цели числа | |
7 | + Дадено е че съм въвел 50 | |
8 | + И съм въвел 70 | |
9 | + Когато натисна "+" | |
10 | + То резултата трябва да е равен на 120 | |
11 | + | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/bg/features/consecutive_calculations.feature
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | +Функционалост: Последователни изчисления | |
2 | + За да не го правят наум | |
3 | + Потребителите | |
4 | + Трябва да могат да извършват последователни изчисления с калкулатора | |
5 | + | |
6 | + Предистория: | |
7 | + Дадено е че съм събрал 3 и 5 | |
8 | + | |
9 | + Сценарий: събиране с резултата от последната операция | |
10 | + Когато въведа 4 | |
11 | + И натисна "+" | |
12 | + То резултата трябва да е равен на 12 | |
13 | + | |
14 | + Сценарий: делене с резултата от последната операция | |
15 | + Когато въведа 2 | |
16 | + И натисна "/" | |
17 | + То резултата трябва да е равен на 4 | |
18 | + | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/bg/features/division.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Фунцкционалност: Делене на числа | |
2 | + За да не го правят наум | |
3 | + Потребителите | |
4 | + Трябва да могат да разделят числа с калкулатора | |
5 | + | |
6 | + Рамка на сценарий: Делене на цели числа | |
7 | + Дадено е че съм въвел <делимо> | |
8 | + И е че съм въвел <делител> | |
9 | + Когато натисна "/" | |
10 | + То резултата трябва да е равен на <частно> | |
11 | + | |
12 | + Примери: | |
13 | + | делимо | делител | частно | | |
14 | + | 100 | 2 | 50 | | |
15 | + | 28 | 7 | 4 | | |
16 | + | 0 | 5 | 0 | | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/bg/features/step_definitons/calculator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | + | |
3 | +Дадено /въвел (\d+)/ do |x| | |
4 | + calc.push x.to_i | |
5 | +end | |
6 | + | |
7 | +Когато /^въведа (\d+)/ do |x| | |
8 | + calc.push x.to_i | |
9 | +end | |
10 | + | |
11 | +Когато /натисна "(.*)"/ do |op| | |
12 | + calc.send op | |
13 | +end | |
14 | + | |
15 | +То /резултата трябва да е равен на (\d+)/ do |result| | |
16 | + calc.result.should == result.to_f | |
17 | +end | |
18 | + | |
19 | +Дадено /събрал (\d+) и (\d+)/ do |x, y| | |
20 | + Дадено %{въвел #{x}} | |
21 | + Дадено %{въвел #{y}} | |
22 | + Дадено %{натисна "+"} | |
23 | +end | |
24 | + | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/bg/features/support/env.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/bg/features/support/world.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/bg/lib/calculator.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | + | |
3 | +class Calculator | |
4 | + def initialize | |
5 | + @stack = [] | |
6 | + end | |
7 | + | |
8 | + def push(arg) | |
9 | + @stack.push arg | |
10 | + end | |
11 | + | |
12 | + def result | |
13 | + @stack.last | |
14 | + end | |
15 | + | |
16 | + def + | |
17 | + @stack.push @stack.pop + @stack.pop | |
18 | + end | |
19 | + | |
20 | + def / | |
21 | + divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work | |
22 | + @stack.push dividend / divisor | |
23 | + end | |
24 | +end | |
0 | 25 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/cat/features/step_definitons/calculator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,21 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'calculadora' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Calculadora.new | |
9 | +end | |
10 | + | |
11 | +Donat /que he introduït (\d+) a la calculadora/ do |n| | |
12 | + @calc.push n.to_i | |
13 | +end | |
14 | + | |
15 | +Quan /premo el (\w+)/ do |op| | |
16 | + @result = @calc.send op | |
17 | +end | |
18 | + | |
19 | +Aleshores /el resultat ha de ser (\d+) a la pantalla/ do |result| | |
20 | + @result.should == result.to_f | |
21 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/cat/features/suma.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Característica: Suma | |
2 | + Per evitar fer errors tontos | |
3 | + Com un matemàtic idiota | |
4 | + Vull saber la suma dels números | |
5 | + | |
6 | + Esquema de l'escenari: Sumar dos números | |
7 | + Donat que he introduït <entrada_1> a la calculadora | |
8 | + I que he introduït <entrada_2> a la calculadora | |
9 | + Quan premo el <botó> | |
10 | + Aleshores el resultat ha de ser <resultat> a la pantalla | |
11 | + | |
12 | + Exemples: | |
13 | + | entrada_1 | entrada_2 | botó | resultat | | |
14 | + | 20 | 30 | add | 50 | | |
15 | + | 2 | 5 | add | 7 | | |
16 | + | 0 | 40 | add | 40 | | |
0 | 17 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/cat/lib/calculadora.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/da/features/step_definitons/kalkulator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'kalkulator' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Kalkulator.new | |
9 | +end | |
10 | + | |
11 | +After do | |
12 | +end | |
13 | + | |
14 | +Given /at jeg har indtastet (\d+)/ do |n| | |
15 | + @calc.push n.to_i | |
16 | +end | |
17 | + | |
18 | +When 'jeg summerer' do | |
19 | + @result = @calc.add | |
20 | +end | |
21 | + | |
22 | +Then /skal resultatet være (\d*)/ do |result| | |
23 | + @result.should == result.to_i | |
24 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/da/features/summering.feature
0 → 100644
... | ... | @@ -0,0 +1,17 @@ |
1 | +Egenskab: Summering | |
2 | + For at slippe for at lave dumme fejl | |
3 | + Som en regnskabsfører | |
4 | + Vil jeg kunne lægge sammen | |
5 | + | |
6 | + Scenarie: to tal | |
7 | + Givet at jeg har indtastet 5 | |
8 | + Og at jeg har indtastet 7 | |
9 | + Når jeg summerer | |
10 | + Så skal resultatet være 12 | |
11 | + | |
12 | + Scenarie: tre tal | |
13 | + Givet at jeg har indtastet 5 | |
14 | + Og at jeg har indtastet 7 | |
15 | + Og at jeg har indtastet 1 | |
16 | + Når jeg summerer | |
17 | + Så skal resultatet være 13 | |
0 | 18 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/da/lib/kalkulator.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/de/features/addition.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Funktionalität: Addition | |
2 | + Um dumme Fehler zu vermeiden | |
3 | + möchte ich als Matheidiot | |
4 | + die Summe zweier Zahlen gesagt bekommen | |
5 | + | |
6 | + Szenariogrundriss: Zwei Zahlen hinzufügen | |
7 | + Gegeben sei ich habe <Eingabe_1> in den Taschenrechner eingegeben | |
8 | + Und ich habe <Eingabe_2> in den Taschenrechner eingegeben | |
9 | + Wenn ich <Knopf> drücke | |
10 | + Dann sollte das Ergebniss auf dem Bildschirm <Ausgabe> sein | |
11 | + | |
12 | + Beispiele: | |
13 | + | Eingabe_1 | Eingabe_2 | Knopf | Ausgabe | | |
14 | + | 20 | 30 | add | 50 | | |
15 | + | 2 | 5 | add | 7 | | |
16 | + | 0 | 40 | add | 40 | | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/de/features/division.feature
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +Funktionalität: Division | |
2 | + Um dumme Fehler zu vermeiden | |
3 | + müssen Kassierer in der Lage sein einen Bruchteil zu berechnen | |
4 | + | |
5 | + Szenario: Normale Zahlen | |
6 | + Gegeben sei ich habe 3 in den Taschenrechner eingegeben | |
7 | + Und ich habe 2 in den Taschenrechner eingegeben | |
8 | + Wenn ich divide drücke | |
9 | + Dann sollte das Ergebniss auf dem Bildschirm 1.5 sein | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/de/features/step_definitons/calculator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'calculator' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Calculator.new | |
9 | +end | |
10 | + | |
11 | +After do | |
12 | +end | |
13 | + | |
14 | +Given /ich habe (\d+) in den Taschenrechner eingegeben/ do |n| | |
15 | + @calc.push n.to_i | |
16 | +end | |
17 | + | |
18 | +When /ich (\w+) drücke/ do |op| | |
19 | + @result = @calc.send op | |
20 | +end | |
21 | + | |
22 | +Then /sollte das Ergebniss auf dem Bildschirm (.*) sein/ do |result| | |
23 | + @result.should == result.to_f | |
24 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/de/lib/calculator.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/en-lol/Rakefile
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +ICANHAZ /^IN TEH BEGINNIN (\d+) CUCUMBRZ$/ do |n| | |
2 | + @basket = Basket.new(n.to_i) | |
3 | +end | |
4 | + | |
5 | +WEN /^I EAT (\d+) CUCUMBRZ$/ do |n| | |
6 | + @belly = Belly.new | |
7 | + @belly.eat(@basket.take(n.to_i)) | |
8 | +end | |
9 | + | |
10 | +DEN /^I HAS (\d+) CUCUMBERZ IN MAH BELLY$/ do |n| | |
11 | + @belly.cukes.should == n.to_i | |
12 | +end | |
13 | + | |
14 | +AN /^IN TEH END (\d+) CUCUMBRZ KTHXBAI$/ do |n| | |
15 | + @basket.cukes.should == n.to_i | |
16 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/en-lol/features/stuffing.feature
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/en-lol/features/support/env.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/en-lol/lib/basket.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/en-lol/lib/belly.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/en/features/addition.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Feature: Addition | |
2 | + In order to avoid silly mistakes | |
3 | + As a math idiot | |
4 | + I want to be told the sum of two numbers | |
5 | + | |
6 | + Scenario Outline: Add two numbers | |
7 | + Given I have entered <input_1> into the calculator | |
8 | + And I have entered <input_2> into the calculator | |
9 | + When I press <button> | |
10 | + Then the result should be <output> on the screen | |
11 | + | |
12 | + Examples: | |
13 | + | input_1 | input_2 | button | output | | |
14 | + | 20 | 30 | add | 50 | | |
15 | + | 2 | 5 | add | 7 | | |
16 | + | 0 | 40 | add | 40 | | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/en/features/division.feature
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +Feature: Division | |
2 | + In order to avoid silly mistakes | |
3 | + Cashiers must be able to calculate a fraction | |
4 | + | |
5 | + Scenario: Regular numbers | |
6 | + Given I have entered 3 into the calculator | |
7 | + And I have entered 2 into the calculator | |
8 | + When I press divide | |
9 | + Then the result should be 1.5 on the screen | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/en/features/step_definitons/calculator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'calculator' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Calculator.new | |
9 | +end | |
10 | + | |
11 | +After do | |
12 | +end | |
13 | + | |
14 | +Given /I have entered (\d+) into the calculator/ do |n| | |
15 | + @calc.push n.to_i | |
16 | +end | |
17 | + | |
18 | +When /I press (\w+)/ do |op| | |
19 | + @result = @calc.send op | |
20 | +end | |
21 | + | |
22 | +Then /the result should be (.*) on the screen/ do |result| | |
23 | + @result.should == result.to_f | |
24 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/en/lib/calculator.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/es/features/adicion.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Característica: adición | |
2 | + Para evitar hacer errores tontos | |
3 | + Como un matemático idiota | |
4 | + Quiero saber la suma de los números | |
5 | + | |
6 | + Esquema del escenario: Sumar dos números | |
7 | + Dado que he introducido <entrada_1> en la calculadora | |
8 | + Y que he introducido <entrada_2> en la calculadora | |
9 | + Cuando oprimo el <botón> | |
10 | + Entonces el resultado debe ser <resultado> en la pantalla | |
11 | + | |
12 | + Ejemplos: | |
13 | + | entrada_1 | entrada_2 | botón | resultado | | |
14 | + | 20 | 30 | add | 50 | | |
15 | + | 2 | 5 | add | 7 | | |
16 | + | 0 | 40 | add | 40 | | |
0 | 17 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/es/features/step_definitons/calculador_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,21 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'calculador' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Calculador.new | |
9 | +end | |
10 | + | |
11 | +Dado /que he introducido (\d+) en la calculadora/ do |n| | |
12 | + @calc.push n.to_i | |
13 | +end | |
14 | + | |
15 | +Cuando /oprimo el (\w+)/ do |op| | |
16 | + @result = @calc.send op | |
17 | +end | |
18 | + | |
19 | +Entonces /el resultado debe ser (.*) en la pantalla/ do |result| | |
20 | + @result.should == result.to_f | |
21 | +end | |
0 | 22 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/es/lib/calculador.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/et/features/jagamine.feature
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +Omadus: Jagamine | |
2 | + Rumalate vigade vältimiseks | |
3 | + Peavad kassapidajad saama arvutada murdudes | |
4 | + | |
5 | + Stsenaarium: Tavalised numrbid | |
6 | + Eeldades et olen sisestanud kalkulaatorisse numbri 3 | |
7 | + Ja olen sisestanud kalkulaatorisse numbri 2 | |
8 | + Kui ma vajutan jaga | |
9 | + Siis vastuseks peab ekraanil kuvatama 1.5 | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/et/features/liitmine.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Omadus: Liitmine | |
2 | + Selleks et vältida rumalaid vigu | |
3 | + Olles matemaatika-puupea | |
4 | + Tahan et mulle öeldaks kahe numbri summa | |
5 | + | |
6 | + Raamstsenaarium: Liida kaks numbrit | |
7 | + Eeldades et olen sisestanud kalkulaatorisse numbri <input_1> | |
8 | + Ja olen sisestanud kalkulaatorisse numbri <input_2> | |
9 | + Kui ma vajutan <button> | |
10 | + Siis vastuseks peab ekraanil kuvatama <output> | |
11 | + | |
12 | + Juhtumid: | |
13 | + | input_1 | input_2 | button | output | | |
14 | + | 20 | 30 | liida | 50 | | |
15 | + | 2 | 5 | liida | 7 | | |
16 | + | 0 | 40 | liida | 40 | | |
0 | 17 | \ No newline at end of file | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'kalkulaator' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Kalkulaator.new | |
9 | +end | |
10 | + | |
11 | +After do | |
12 | +end | |
13 | + | |
14 | +Given /olen sisestanud kalkulaatorisse numbri (\d+)/ do |n| | |
15 | + @calc.push n.to_i | |
16 | +end | |
17 | + | |
18 | +When /ma vajutan (\w+)/ do |op| | |
19 | + @result = @calc.send op | |
20 | +end | |
21 | + | |
22 | +Then /vastuseks peab ekraanil kuvatama (.*)/ do |result| | |
23 | + @result.should == result.to_f | |
24 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/et/lib/kalkulaator.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/fi/features/jakolasku.feature
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +Ominaisuus: Jakolasku | |
2 | + Välttyäkseen hölmöiltä virheiltä | |
3 | + Kassanhoitajan on voitava laskea osamäärä | |
4 | + | |
5 | + Tapaus: Kokonaislukujen jakolasku | |
6 | + Oletetaan että olen syöttänyt laskimeen luvun 3 | |
7 | + Ja että olen syöttänyt laskimeen luvun 2 | |
8 | + Kun painan "jaa" | |
9 | + Niin laskimen ruudulla pitäisi näkyä tulos 1.5 | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/fi/features/step_definitons/laskin_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'laskin' | |
6 | + | |
7 | +Before do | |
8 | + @laskin = Laskin.new | |
9 | +end | |
10 | + | |
11 | +After do | |
12 | +end | |
13 | + | |
14 | +Given /että olen syöttänyt laskimeen luvun (\d+)/ do |n| | |
15 | + @laskin.pinoa n.to_i | |
16 | +end | |
17 | + | |
18 | +When /painan "(\w+)"/ do |op| | |
19 | + @tulos = @laskin.send op | |
20 | +end | |
21 | + | |
22 | +Then /laskimen ruudulla pitäisi näkyä tulos (.*)/ do |tulos| | |
23 | + @tulos.should == tulos.to_f | |
24 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/fi/features/yhteenlasku.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +Ominaisuus: Yhteenlasku | |
2 | + Välttyäkseni hölmöiltä virheiltä | |
3 | + Koska olen laskutaidoton | |
4 | + Haluan että yhteenlaskut lasketaan puolestani | |
5 | + | |
6 | + Tapausaihio: Kahden luvun summa | |
7 | + Oletetaan että olen syöttänyt laskimeen luvun 50 | |
8 | + Ja että olen syöttänyt laskimeen luvun 70 | |
9 | + Kun painan "summaa" | |
10 | + Niin laskimen ruudulla pitäisi näkyä tulos 120 | |
11 | + | |
12 | + Tapaukset: | |
13 | + | luku_1 | luku_2 | nappi | tulos | | |
14 | + | 20 | 30 | summaa | 50 | | |
15 | + | 2 | 5 | summaa | 7 | | |
16 | + | 0 | 40 | summaa | 40 | | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/fi/lib/laskin.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/fr/features/addition.feature
0 → 100644
... | ... | @@ -0,0 +1,17 @@ |
1 | +Fonctionnalité: Addition | |
2 | + Afin de gagner du temps lors du calcul de la facture | |
3 | + En tant que commerçant | |
4 | + Je souhaite pouvoir faire une additionn | |
5 | + | |
6 | + Plan du Scénario: Addition de deux nombres | |
7 | + Soit une calculatrice | |
8 | + Et que j'entre <a> pour le premier nombre | |
9 | + Et que je tape sur la touche "+" | |
10 | + Et que j'entre <b> pour le second nombre | |
11 | + Lorsque je tape sur la touche "=" | |
12 | + Alors le résultat affiché doit être <somme> | |
13 | + | |
14 | + Exemples: | |
15 | + | a | b | somme | | |
16 | + | 2 | 2 | 4 | | |
17 | + | 2 | 3 | 5 | | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'calculatrice' | |
6 | + | |
7 | +Soit /^une calculatrice$/ do | |
8 | + @calc = Calculatrice.new | |
9 | +end | |
10 | + | |
11 | +Et /^que j'entre (\d+) pour le (.*) nombre/ do |n, x| | |
12 | + @calc.push n.to_i | |
13 | +end | |
14 | + | |
15 | +Lorsque /^je tape sur la touche "="$/ do | |
16 | + @expected_result = @calc.additionner | |
17 | +end | |
18 | + | |
19 | +Alors /le résultat affiché doit être (\d*)/ do |result| | |
20 | + result.to_i.should == @expected_result | |
21 | +end | |
22 | + | |
23 | +Soit /^que je tape sur la touche "\+"$/ do | |
24 | + # noop | |
25 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/fr/lib/calculatrice.rb
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/he/features/addition.feature
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +תכונה: חיבור | |
2 | + כדי למנוע טעויות טפשיות | |
3 | + בתור בור מתמטי | |
4 | + אני רוצה שיגידו לי את הסכום של שני מספרים | |
5 | + | |
6 | + תבנית תרחיש: חבר שני מספרים | |
7 | + בהינתן שהזנתי <קלט_1> למחשבון | |
8 | + וגם שהזנתי <קלט_2> למחשבון | |
9 | + כאשר אני לוחץ על <כפתור> | |
10 | + אז התוצאה על המסך צריכה להיות <פלט> | |
11 | + | |
12 | + דוגמאות: | |
13 | + | קלט_1 | קלט_2 | כפתור | פלט | | |
14 | + | 20 | 30 | חבר | 50 | | |
15 | + | 2 | 5 | חבר | 7 | | |
16 | + | 0 | 40 | חבר | 40 | | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/he/features/division.feature
0 → 100644
vendor/gems/cucumber-0.3.11/examples/i18n/he/features/step_definitons/calculator_steps.rb
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +# encoding: utf-8 | |
2 | +require 'spec/expectations' | |
3 | +$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project | |
4 | +require 'cucumber/formatter/unicode' | |
5 | +require 'calculator' | |
6 | + | |
7 | +Before do | |
8 | + @calc = Calculator.new | |
9 | +end | |
10 | + | |
11 | +After do | |
12 | +end | |
13 | + | |
14 | +Given /שהזנתי (\d+) למחשבון/ do |n| | |
15 | + @calc.push n.to_i | |
16 | +end | |
17 | + | |
18 | +When /אני לוחץ על (\w+)/ do |op| | |
19 | + @result = @calc.send op | |
20 | +end | |
21 | + | |
22 | +Then /התוצאה על המסך צריכה להיות (.*)/ do |result| | |
23 | + @result.should == result.to_f | |
24 | +end | ... | ... |
vendor/gems/cucumber-0.3.11/examples/i18n/he/lib/calculator.rb
0 → 100644