samstokes-rspec-stories 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,79 @@
1
+ # WARNING - THIS IS PURELY EXPERIMENTAL AT THIS POINT
2
+ # Courtesy of Brian Takita and Yurii Rashkovskii
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. .. .. .. rspec lib])
5
+ if defined?(ActiveRecord::Base)
6
+ require 'test_help'
7
+ else
8
+ require 'action_controller/test_process'
9
+ require 'action_controller/integration'
10
+ end
11
+ require 'test/unit/testresult'
12
+ require 'spec'
13
+ require 'spec/rails'
14
+
15
+ Test::Unit.run = true
16
+
17
+ ActionController::Integration::Session.__send__ :include, Spec::Matchers
18
+ ActionController::Integration::Session.__send__ :include, Spec::Rails::Matchers
19
+
20
+ class RailsStory < ActionController::IntegrationTest
21
+ if defined?(ActiveRecord::Base)
22
+ self.use_transactional_fixtures = true
23
+ else
24
+ def self.fixture_table_names; []; end # Workaround for projects that don't use ActiveRecord
25
+ end
26
+
27
+ def initialize #:nodoc:
28
+ # TODO - eliminate this hack, which is here to stop
29
+ # Rails Stories from dumping the example summary.
30
+ Spec::Runner::Options.class_eval do
31
+ def examples_should_be_run?
32
+ false
33
+ end
34
+ end
35
+ @_result = Test::Unit::TestResult.new
36
+ end
37
+ end
38
+
39
+ class ActiveRecordSafetyListener
40
+ include Singleton
41
+ def scenario_started(*args)
42
+ if defined?(ActiveRecord::Base)
43
+ if ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
44
+ ActiveRecord::Base.connection.increment_open_transactions
45
+ else
46
+ ActiveRecord::Base.__send__ :increment_open_transactions
47
+ end
48
+ end
49
+ ActiveRecord::Base.connection.begin_db_transaction
50
+ end
51
+
52
+ def scenario_succeeded(*args)
53
+ if defined?(ActiveRecord::Base)
54
+ ActiveRecord::Base.connection.rollback_db_transaction
55
+ if ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
56
+ ActiveRecord::Base.connection.decrement_open_transactions
57
+ else
58
+ ActiveRecord::Base.__send__ :decrement_open_transactions
59
+ end
60
+ end
61
+ end
62
+ alias :scenario_pending :scenario_succeeded
63
+ alias :scenario_failed :scenario_succeeded
64
+ end
65
+
66
+ class Spec::Story::Runner::ScenarioRunner
67
+ def initialize
68
+ @listeners = [ActiveRecordSafetyListener.instance]
69
+ end
70
+ end
71
+
72
+ class Spec::Story::GivenScenario
73
+ def perform(instance, name = nil)
74
+ scenario = Spec::Story::Runner::StoryRunner.scenario_from_current_story @name
75
+ runner = Spec::Story::Runner::ScenarioRunner.new
76
+ runner.instance_variable_set(:@listeners,[])
77
+ runner.run(scenario, instance)
78
+ end
79
+ end
@@ -4,7 +4,7 @@ module Spec
4
4
  unless defined? MAJOR
5
5
  MAJOR = 1
6
6
  MINOR = 0
7
- TINY = 0
7
+ TINY = 2
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
10
10
 
@@ -12,4 +12,4 @@ module Spec
12
12
  end
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rspec-stories}
5
- s.version = "1.0.1"
5
+ s.version = "1.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["RSpec Development Team"]
@@ -10,14 +10,14 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{Behaviour Driven Development for Ruby.}
11
11
  s.email = ["rspec-devel@rubyforge.org"]
12
12
  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt"]
13
- s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "init.rb", "lib/spec/runner/formatter/story/html_formatter.rb", "lib/spec/runner/formatter/story/plain_text_formatter.rb", "lib/spec/runner/formatter/story/progress_bar_formatter.rb", "lib/spec/runner/options_extensions.rb", "lib/spec/stories.rb", "lib/spec/story/extensions.rb", "lib/spec/story/extensions/main.rb", "lib/spec/story/extensions/regexp.rb", "lib/spec/story/extensions/string.rb", "lib/spec/story/given_scenario.rb", "lib/spec/story/runner.rb", "lib/spec/story/runner/plain_text_story_runner.rb", "lib/spec/story/runner/scenario_collector.rb", "lib/spec/story/runner/scenario_runner.rb", "lib/spec/story/runner/story_mediator.rb", "lib/spec/story/runner/story_parser.rb", "lib/spec/story/runner/story_runner.rb", "lib/spec/story/scenario.rb", "lib/spec/story/step.rb", "lib/spec/story/step_group.rb", "lib/spec/story/step_mother.rb", "lib/spec/story/story.rb", "lib/spec/story/version.rb", "lib/spec/story/world.rb", "resources/rake/verify_rcov.rake", "rspec-stories.gemspec", "spec/spec.opts", "spec/spec/runner/formatter/story/html_formatter_spec.rb", "spec/spec/runner/formatter/story/plain_text_formatter_spec.rb", "spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb", "spec/spec/runner/most_recent_spec.rb", "spec/spec/runner/options_extensions_spec.rb", "spec/spec/runner/resources/a_bar.rb", "spec/spec/runner/resources/a_foo.rb", "spec/spec/runner/resources/a_spec.rb", "spec/spec/runner/resources/custom_example_group_runner.rb", "spec/spec/runner/resources/utf8_encoded.rb", "spec/spec/runner_spec.rb", "spec/spec/spec_classes.rb", "spec/spec/story/builders.rb", "spec/spec/story/extensions/main_spec.rb", "spec/spec/story/extensions_spec.rb", "spec/spec/story/given_scenario_spec.rb", "spec/spec/story/runner/plain_text_story_runner_spec.rb", "spec/spec/story/runner/scenario_collector_spec.rb", "spec/spec/story/runner/scenario_runner_spec.rb", "spec/spec/story/runner/story_mediator_spec.rb", "spec/spec/story/runner/story_parser_spec.rb", "spec/spec/story/runner/story_runner_spec.rb", "spec/spec/story/runner_spec.rb", "spec/spec/story/scenario_spec.rb", "spec/spec/story/step_group_spec.rb", "spec/spec/story/step_mother_spec.rb", "spec/spec/story/step_spec.rb", "spec/spec/story/story_helper.rb", "spec/spec/story/story_spec.rb", "spec/spec/story/world_spec.rb", "spec/spec_helper.rb", "story_server/prototype/javascripts/builder.js", "story_server/prototype/javascripts/controls.js", "story_server/prototype/javascripts/dragdrop.js", "story_server/prototype/javascripts/effects.js", "story_server/prototype/javascripts/prototype.js", "story_server/prototype/javascripts/rspec.js", "story_server/prototype/javascripts/scriptaculous.js", "story_server/prototype/javascripts/slider.js", "story_server/prototype/javascripts/sound.js", "story_server/prototype/javascripts/unittest.js", "story_server/prototype/lib/server.rb", "story_server/prototype/stories.html", "story_server/prototype/stylesheets/rspec.css", "story_server/prototype/stylesheets/test.css"]
13
+ s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "init.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/runner/formatter/story/html_formatter.rb", "lib/spec/runner/formatter/story/plain_text_formatter.rb", "lib/spec/runner/formatter/story/progress_bar_formatter.rb", "lib/spec/runner/options_extensions.rb", "lib/spec/stories.rb", "lib/spec/story/extensions.rb", "lib/spec/story/extensions/main.rb", "lib/spec/story/extensions/regexp.rb", "lib/spec/story/extensions/string.rb", "lib/spec/story/given_scenario.rb", "lib/spec/story/runner.rb", "lib/spec/story/runner/plain_text_story_runner.rb", "lib/spec/story/runner/scenario_collector.rb", "lib/spec/story/runner/scenario_runner.rb", "lib/spec/story/runner/story_mediator.rb", "lib/spec/story/runner/story_parser.rb", "lib/spec/story/runner/story_runner.rb", "lib/spec/story/scenario.rb", "lib/spec/story/step.rb", "lib/spec/story/step_group.rb", "lib/spec/story/step_mother.rb", "lib/spec/story/story.rb", "lib/spec/story/version.rb", "lib/spec/story/world.rb", "resources/rake/verify_rcov.rake", "rspec-stories.gemspec", "spec/spec.opts", "spec/spec/runner/formatter/story/html_formatter_spec.rb", "spec/spec/runner/formatter/story/plain_text_formatter_spec.rb", "spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb", "spec/spec/runner/most_recent_spec.rb", "spec/spec/runner/options_extensions_spec.rb", "spec/spec/runner/resources/a_bar.rb", "spec/spec/runner/resources/a_foo.rb", "spec/spec/runner/resources/a_spec.rb", "spec/spec/runner/resources/custom_example_group_runner.rb", "spec/spec/runner/resources/utf8_encoded.rb", "spec/spec/runner_spec.rb", "spec/spec/spec_classes.rb", "spec/spec/story/builders.rb", "spec/spec/story/extensions/main_spec.rb", "spec/spec/story/extensions_spec.rb", "spec/spec/story/given_scenario_spec.rb", "spec/spec/story/runner/plain_text_story_runner_spec.rb", "spec/spec/story/runner/scenario_collector_spec.rb", "spec/spec/story/runner/scenario_runner_spec.rb", "spec/spec/story/runner/story_mediator_spec.rb", "spec/spec/story/runner/story_parser_spec.rb", "spec/spec/story/runner/story_runner_spec.rb", "spec/spec/story/runner_spec.rb", "spec/spec/story/scenario_spec.rb", "spec/spec/story/step_group_spec.rb", "spec/spec/story/step_mother_spec.rb", "spec/spec/story/step_spec.rb", "spec/spec/story/story_helper.rb", "spec/spec/story/story_spec.rb", "spec/spec/story/world_spec.rb", "spec/spec_helper.rb", "story_server/prototype/javascripts/builder.js", "story_server/prototype/javascripts/controls.js", "story_server/prototype/javascripts/dragdrop.js", "story_server/prototype/javascripts/effects.js", "story_server/prototype/javascripts/prototype.js", "story_server/prototype/javascripts/rspec.js", "story_server/prototype/javascripts/scriptaculous.js", "story_server/prototype/javascripts/slider.js", "story_server/prototype/javascripts/sound.js", "story_server/prototype/javascripts/unittest.js", "story_server/prototype/lib/server.rb", "story_server/prototype/stories.html", "story_server/prototype/stylesheets/rspec.css", "story_server/prototype/stylesheets/test.css"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://rspec.info/}
16
16
  s.rdoc_options = ["--main", "README.txt"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = %q{rspec-stories}
19
19
  s.rubygems_version = %q{1.3.1}
20
- s.summary = %q{rspec-stories 1.0.0}
20
+ s.summary = %q{rspec-stories 1.0.2}
21
21
 
22
22
  if s.respond_to? :specification_version then
23
23
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samstokes-rspec-stories
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - RSpec Development Team
@@ -51,6 +51,7 @@ files:
51
51
  - README.txt
52
52
  - Rakefile
53
53
  - init.rb
54
+ - lib/spec/rails/story_adapter.rb
54
55
  - lib/spec/runner/formatter/story/html_formatter.rb
55
56
  - lib/spec/runner/formatter/story/plain_text_formatter.rb
56
57
  - lib/spec/runner/formatter/story/progress_bar_formatter.rb
@@ -149,6 +150,6 @@ rubyforge_project: rspec-stories
149
150
  rubygems_version: 1.2.0
150
151
  signing_key:
151
152
  specification_version: 2
152
- summary: rspec-stories 1.0.0
153
+ summary: rspec-stories 1.0.2
153
154
  test_files: []
154
155