Permalink
Browse files

reorg the examples dir

  • Loading branch information...
1 parent f4a3f48 commit 11955762536ab974bd803ccb1060296dcd6aad2a @dchelimsky committed Nov 9, 2008
Showing with 110 additions and 800 deletions.
  1. +44 −71 Manifest.txt
  2. 0 {failing_examples → examples/failing}/README.txt
  3. 0 {failing_examples → examples/failing}/diffing_spec.rb
  4. 0 {failing_examples → examples/failing}/failing_autogenerated_docstrings_example.rb
  5. 0 {failing_examples → examples/failing}/failure_in_setup.rb
  6. 0 {failing_examples → examples/failing}/failure_in_teardown.rb
  7. 0 {failing_examples → examples/failing}/mocking_example.rb
  8. 0 {failing_examples → examples/failing}/mocking_with_flexmock.rb
  9. 0 {failing_examples → examples/failing}/mocking_with_mocha.rb
  10. 0 {failing_examples → examples/failing}/mocking_with_rr.rb
  11. 0 {failing_examples → examples/failing}/partial_mock_example.rb
  12. 0 {failing_examples → examples/failing}/predicate_example.rb
  13. 0 {failing_examples → examples/failing}/raising_example.rb
  14. 0 {failing_examples → examples/failing}/spec_helper.rb
  15. 0 {failing_examples → examples/failing}/syntax_error_example.rb
  16. 0 {failing_examples → examples/failing}/team_spec.rb
  17. 0 {failing_examples → examples/failing}/timeout_behaviour.rb
  18. 0 examples/{pure → passing}/autogenerated_docstrings_example.rb
  19. 0 examples/{pure → passing}/before_and_after_example.rb
  20. 0 examples/{pure → passing}/behave_as_example.rb
  21. 0 examples/{pure → passing}/custom_expectation_matchers.rb
  22. +1 −1 examples/{pure → passing}/custom_formatter.rb
  23. 0 examples/{pure → passing}/dynamic_spec.rb
  24. 0 examples/{pure → passing}/file_accessor.rb
  25. 0 examples/{pure → passing}/file_accessor_spec.rb
  26. 0 examples/{pure → passing}/greeter_spec.rb
  27. 0 examples/{pure → passing}/helper_method_example.rb
  28. 0 examples/{pure → passing}/io_processor.rb
  29. 0 examples/{pure → passing}/io_processor_spec.rb
  30. 0 examples/{pure → passing}/legacy_spec.rb
  31. 0 examples/{pure → passing}/mocking_example.rb
  32. 0 examples/{pure → passing}/multi_threaded_behaviour_runner.rb
  33. 0 examples/{pure → passing}/nested_classes_example.rb
  34. 0 examples/{pure → passing}/partial_mock_example.rb
  35. 0 examples/{pure → passing}/pending_example.rb
  36. 0 examples/{pure → passing}/predicate_example.rb
  37. 0 examples/{pure → passing}/priority.txt
  38. 0 examples/{pure → passing}/shared_example_group_example.rb
  39. 0 examples/{pure → passing}/shared_stack_examples.rb
  40. 0 examples/{pure → passing}/spec_helper.rb
  41. 0 examples/{pure → passing}/stack.rb
  42. 0 examples/{pure → passing}/stack_spec.rb
  43. 0 examples/{pure → passing}/stack_spec_with_nested_example_groups.rb
  44. 0 examples/{pure → passing}/stubbing_example.rb
  45. 0 examples/{pure → passing}/yielding_example.rb
  46. +0 −13 examples/stories/adder.rb
  47. +0 −34 examples/stories/addition
  48. +0 −9 examples/stories/addition.rb
  49. +0 −65 examples/stories/calculator.rb
  50. +0 −5 examples/stories/game-of-life/.loadpath
  51. +0 −21 examples/stories/game-of-life/README.txt
  52. +0 −6 examples/stories/game-of-life/behaviour/everything.rb
  53. +0 −3 examples/stories/game-of-life/behaviour/examples/examples.rb
  54. +0 −35 examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
  55. +0 −66 examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
  56. +0 −21 examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
  57. +0 −21 examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
  58. +0 −42 examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
  59. +0 −42 examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
  60. +0 −17 examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
  61. +0 −53 examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
  62. +0 −52 examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
  63. +0 −6 examples/stories/game-of-life/behaviour/stories/helper.rb
  64. +0 −26 examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
  65. +0 −5 examples/stories/game-of-life/behaviour/stories/steps.rb
  66. +0 −3 examples/stories/game-of-life/behaviour/stories/stories.rb
  67. +0 −22 examples/stories/game-of-life/behaviour/stories/stories.txt
  68. +0 −3 examples/stories/game-of-life/life.rb
  69. +0 −23 examples/stories/game-of-life/life/game.rb
  70. +0 −43 examples/stories/game-of-life/life/grid.rb
  71. +0 −9 examples/stories/helper.rb
  72. +0 −18 examples/stories/steps/addition_steps.rb
  73. +2 −2 rspec.gemspec
  74. +2 −2 spec/spec/runner/command_line_spec.rb
  75. +6 −6 spec/spec/runner/formatter/html_formatted-1.8.4.html
  76. +9 −9 spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html
  77. +6 −6 spec/spec/runner/formatter/html_formatted-1.8.5.html
  78. +10 −10 spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html
  79. +6 −6 spec/spec/runner/formatter/html_formatted-1.8.6.html
  80. +1 −1 spec/spec/runner/formatter/html_formatter_spec.rb
  81. +5 −5 spec/spec/runner/formatter/spec_mate_formatter_spec.rb
  82. +6 −6 spec/spec/runner/formatter/text_mate_formatted-1.8.4.html
  83. +6 −6 spec/spec/runner/formatter/text_mate_formatted-1.8.6.html
  84. +4 −4 stories/example_groups/autogenerated_docstrings
  85. +2 −2 stories/example_groups/nested_groups
View
@@ -7,77 +7,50 @@ Rakefile
TODO.txt
bin/autospec
bin/spec
-examples/pure/autogenerated_docstrings_example.rb
-examples/pure/before_and_after_example.rb
-examples/pure/behave_as_example.rb
-examples/pure/custom_expectation_matchers.rb
-examples/pure/custom_formatter.rb
-examples/pure/dynamic_spec.rb
-examples/pure/file_accessor.rb
-examples/pure/file_accessor_spec.rb
-examples/pure/greeter_spec.rb
-examples/pure/helper_method_example.rb
-examples/pure/io_processor.rb
-examples/pure/io_processor_spec.rb
-examples/pure/legacy_spec.rb
-examples/pure/mocking_example.rb
-examples/pure/multi_threaded_behaviour_runner.rb
-examples/pure/nested_classes_example.rb
-examples/pure/partial_mock_example.rb
-examples/pure/pending_example.rb
-examples/pure/predicate_example.rb
-examples/pure/priority.txt
-examples/pure/shared_example_group_example.rb
-examples/pure/shared_stack_examples.rb
-examples/pure/spec_helper.rb
-examples/pure/stack.rb
-examples/pure/stack_spec.rb
-examples/pure/stack_spec_with_nested_example_groups.rb
-examples/pure/stubbing_example.rb
-examples/pure/yielding_example.rb
-examples/stories/adder.rb
-examples/stories/addition
-examples/stories/addition.rb
-examples/stories/calculator.rb
-examples/stories/game-of-life/.loadpath
-examples/stories/game-of-life/README.txt
-examples/stories/game-of-life/behaviour/everything.rb
-examples/stories/game-of-life/behaviour/examples/examples.rb
-examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
-examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
-examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
-examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
-examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
-examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
-examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
-examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
-examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
-examples/stories/game-of-life/behaviour/stories/helper.rb
-examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
-examples/stories/game-of-life/behaviour/stories/steps.rb
-examples/stories/game-of-life/behaviour/stories/stories.rb
-examples/stories/game-of-life/behaviour/stories/stories.txt
-examples/stories/game-of-life/life.rb
-examples/stories/game-of-life/life/game.rb
-examples/stories/game-of-life/life/grid.rb
-examples/stories/helper.rb
-examples/stories/steps/addition_steps.rb
-failing_examples/README.txt
-failing_examples/diffing_spec.rb
-failing_examples/failing_autogenerated_docstrings_example.rb
-failing_examples/failure_in_setup.rb
-failing_examples/failure_in_teardown.rb
-failing_examples/mocking_example.rb
-failing_examples/mocking_with_flexmock.rb
-failing_examples/mocking_with_mocha.rb
-failing_examples/mocking_with_rr.rb
-failing_examples/partial_mock_example.rb
-failing_examples/predicate_example.rb
-failing_examples/raising_example.rb
-failing_examples/spec_helper.rb
-failing_examples/syntax_error_example.rb
-failing_examples/team_spec.rb
-failing_examples/timeout_behaviour.rb
+examples/failing/README.txt
+examples/failing/diffing_spec.rb
+examples/failing/failing_autogenerated_docstrings_example.rb
+examples/failing/failure_in_setup.rb
+examples/failing/failure_in_teardown.rb
+examples/failing/mocking_example.rb
+examples/failing/mocking_with_flexmock.rb
+examples/failing/mocking_with_mocha.rb
+examples/failing/mocking_with_rr.rb
+examples/failing/partial_mock_example.rb
+examples/failing/predicate_example.rb
+examples/failing/raising_example.rb
+examples/failing/spec_helper.rb
+examples/failing/syntax_error_example.rb
+examples/failing/team_spec.rb
+examples/failing/timeout_behaviour.rb
+examples/passing/autogenerated_docstrings_example.rb
+examples/passing/before_and_after_example.rb
+examples/passing/behave_as_example.rb
+examples/passing/custom_expectation_matchers.rb
+examples/passing/custom_formatter.rb
+examples/passing/dynamic_spec.rb
+examples/passing/file_accessor.rb
+examples/passing/file_accessor_spec.rb
+examples/passing/greeter_spec.rb
+examples/passing/helper_method_example.rb
+examples/passing/io_processor.rb
+examples/passing/io_processor_spec.rb
+examples/passing/legacy_spec.rb
+examples/passing/mocking_example.rb
+examples/passing/multi_threaded_behaviour_runner.rb
+examples/passing/nested_classes_example.rb
+examples/passing/partial_mock_example.rb
+examples/passing/pending_example.rb
+examples/passing/predicate_example.rb
+examples/passing/priority.txt
+examples/passing/shared_example_group_example.rb
+examples/passing/shared_stack_examples.rb
+examples/passing/spec_helper.rb
+examples/passing/stack.rb
+examples/passing/stack_spec.rb
+examples/passing/stack_spec_with_nested_example_groups.rb
+examples/passing/stubbing_example.rb
+examples/passing/yielding_example.rb
init.rb
lib/autotest/discover.rb
lib/autotest/rspec.rb
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -2,7 +2,7 @@
require 'spec/runner/formatter/progress_bar_formatter'
# Example of a formatter with custom bactrace printing. Run me with:
-# ruby bin/spec failing_examples -r examples/custom_formatter.rb -f CustomFormatter
+# ruby bin/spec examples/failing -r examples/custom_formatter.rb -f CustomFormatter
class CustomFormatter < Spec::Runner::Formatter::ProgressBarFormatter
def backtrace_line(line)
line.gsub(/([^:]*\.rb):(\d*)/) do
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -1,13 +0,0 @@
-class Adder
- def initialize
- @addends = []
- end
-
- def <<(val)
- @addends << val
- end
-
- def sum
- @addends.inject(0) { |sum_so_far, val| sum_so_far + val }
- end
-end
View
@@ -1,34 +0,0 @@
-This is a story about a calculator. The text up here above the Story: declaration
-won't be processed, so you can write whatever you wish!
-
-Story: simple addition
-
- As an accountant
- I want to add numbers
- So that I can count beans
-
- Scenario: add one plus one
- Given an addend of 1
- And an addend of 1
-
- When the addends are addeds
-
- Then the sum should be 3
- And the corks should be popped
-
- Scenario: add two plus five
- Given an addend of 2
- And an addend of 5
-
- When the addends are added
-
- Then the sum should be 7
- Then it should snow
-
- Scenario: add three more
- GivenScenario add two plus five
- And an addend of 3
-
- When the addends are added
-
- Then the sum should be 10
@@ -1,9 +0,0 @@
-require File.join(File.dirname(__FILE__), "helper")
-require File.join(File.dirname(__FILE__), "adder")
-
-# with_steps_for :addition, :more_addition do
-with_steps_for :addition, :more_addition do
- # Then("the corks should be popped") { }
- run File.expand_path(__FILE__).gsub(".rb","")
-end
-
@@ -1,65 +0,0 @@
-$:.push File.join(File.dirname(__FILE__), *%w[.. .. lib])
-require 'spec'
-
-class AdditionMatchers < Spec::Story::StepGroup
- steps do |add|
- add.given("an addend of $addend") do |addend|
- @adder ||= Adder.new
- @adder << addend.to_i
- end
- end
-end
-
-steps = AdditionMatchers.new do |add|
- add.then("the sum should be $sum") do |sum|
- @sum.should == sum.to_i
- end
-end
-
-steps.when("they are added") do
- @sum = @adder.sum
-end
-
-# This Story uses steps (see above) instead of blocks
-# passed to Given, When and Then
-
-Story "addition", %{
- As an accountant
- I want to add numbers
- So that I can count some beans
-}, :steps_for => steps do
- Scenario "2 + 3" do
- Given "an addend of 2"
- And "an addend of 3"
- When "they are added"
- Then "the sum should be 5"
- end
-
- # This scenario uses GivenScenario, which silently runs
- # all the steps in a previous scenario.
-
- Scenario "add 4 more" do
- GivenScenario "2 + 3"
- Given "an addend of 4"
- When "they are added"
- Then "the sum should be 9"
- end
-end
-
-# And the class that makes the story pass
-
-class Adder
- def << addend
- addends << addend
- end
-
- def sum
- @addends.inject(0) do |result, addend|
- result + addend.to_i
- end
- end
-
- def addends
- @addends ||= []
- end
-end
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<loadpath>
- <pathentry path="" type="src"/>
- <pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/>
-</loadpath>
@@ -1,21 +0,0 @@
-John Conway's Game of Life
-
-The Rules
----------
-The Game of Life was invented by John Conway (as you might have gathered).
-The game is played on a field of cells, each of which has eight neighbors (adjacent cells).
-A cell is either occupied (by an organism) or not.
-The rules for deriving a generation from the previous one are these:
-
-Survival
---------
-If an occupied cell has 2 or 3 neighbors, the organism survives to the next generation.
-
-Death
------
-If an occupied cell has 0, 1, 4, 5, 6, 7, or 8 occupied neighbors, the organism dies
-(0, 1: of loneliness; 4 thru 8: of overcrowding).
-
-Birth
------
-If an unoccupied cell has 3 occupied neighbors, it becomes occupied.
@@ -1,6 +0,0 @@
-$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-$:.unshift File.join(File.dirname(__FILE__), '..')
-
-require 'spec'
-require 'behaviour/examples/examples'
-require 'behaviour/stories/stories'
@@ -1,3 +0,0 @@
-require 'spec'
-require 'behaviour/examples/game_behaviour'
-require 'behaviour/examples/grid_behaviour'
@@ -1,35 +0,0 @@
-require 'life'
-
-describe Game do
- it 'should have a grid' do
- # given
- game = Game.new(5, 5)
-
- # then
- game.grid.should be_kind_of(Grid)
- end
-
- it 'should create a cell' do
- # given
- game = Game.new(2, 2)
- expected_grid = Grid.from_string( 'X. ..' )
-
- # when
- game.create_at(0, 0)
-
- # then
- game.grid.should == expected_grid
- end
-
- it 'should destroy a cell' do
- # given
- game = Game.new(2,2)
- game.grid = Grid.from_string('X. ..')
-
- # when
- game.destroy_at(0,0)
-
- # then
- game.grid.should == Grid.from_string('.. ..')
- end
-end
@@ -1,66 +0,0 @@
-describe Grid do
- it 'should be empty when created' do
- # given
- expected_contents = [
- [0, 0, 0],
- [0, 0, 0]
- ]
- grid = Grid.new(2, 3)
-
- # when
- contents = grid.contents
-
- # then
- contents.should == expected_contents
- end
-
- it 'should compare equal based on its contents' do
- # given
- grid1 = Grid.new(2, 3)
- grid2 = Grid.new(2, 3)
-
- # then
- grid1.should == grid2
- end
-
- it 'should be able to replace its contents' do
- # given
- grid = Grid.new(2,2)
- new_contents = [[0,1,0], [1,0,1]]
-
- # when
- grid.contents = new_contents
-
- # then
- grid.contents.should == new_contents
- grid.rows.should == 2
- grid.columns.should == 3
- end
-
- it 'should add an organism' do
- # given
- grid = Grid.new(2, 2)
- expected = Grid.new(2, 2)
- expected.contents = [[1,0],[0,0]]
-
- # when
- grid.create_at(0,0)
-
- # then
- grid.should == expected
- end
-
- it 'should create itself from a string' do
- # given
- expected = Grid.new 3, 3
- expected.create_at(0,0)
- expected.create_at(1,0)
- expected.create_at(2,2)
-
- # when
- actual = Grid.from_string "X.. X.. ..X"
-
- # then
- actual.should == expected
- end
-end
Oops, something went wrong.

0 comments on commit 1195576

Please sign in to comment.