rspec-rails 2.0.0.beta.9.1 → 2.0.0.beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. data/Rakefile +1 -1
  2. data/VERSION +1 -1
  3. data/features/model_specs/transactional_examples.feature +25 -0
  4. data/lib/generators/rspec/controller/controller_generator.rb +2 -1
  5. data/lib/generators/rspec/install/install_generator.rb +4 -10
  6. data/lib/{rspec/rails → generators/rspec/install/templates/lib}/tasks/rspec.rake +1 -0
  7. data/lib/generators/rspec/install/templates/spec/spec_helper.rb +2 -0
  8. data/lib/rspec-rails.rb +1 -5
  9. data/lib/rspec/rails.rb +2 -5
  10. data/lib/rspec/rails/adapters.rb +3 -0
  11. data/lib/rspec/rails/configuration.rb +8 -0
  12. data/lib/rspec/rails/example/controller_example_group.rb +23 -21
  13. data/lib/rspec/rails/example/helper_example_group.rb +31 -30
  14. data/lib/rspec/rails/example/mailer_example_group.rb +20 -18
  15. data/lib/rspec/rails/example/request_example_group.rb +26 -24
  16. data/lib/rspec/rails/example/view_example_group.rb +51 -49
  17. data/lib/rspec/rails/fixture_support.rb +31 -0
  18. data/lib/rspec/rails/matchers.rb +2 -0
  19. data/rspec-rails.gemspec +10 -12
  20. data/spec/rspec/rails/example/controller_example_group_spec.rb +9 -7
  21. data/spec/rspec/rails/example/helper_example_group_spec.rb +16 -14
  22. data/spec/rspec/rails/example/mailer_example_group_spec.rb +9 -7
  23. data/spec/rspec/rails/example/request_example_group_spec.rb +9 -7
  24. data/spec/rspec/rails/example/view_example_group_spec.rb +59 -57
  25. data/spec/rspec/rails/example/view_rendering_spec.rb +50 -49
  26. metadata +10 -13
  27. data/lib/generators/rspec/install/templates/config/initializers/rspec_generator.rb.tt +0 -6
  28. data/lib/rspec/rails/transactional_database_support.rb +0 -40
  29. data/spec/rspec/rails/transactional_database_support_spec.rb +0 -54
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ begin
25
25
  gem.homepage = "http://github.com/rspec/rspec-rails"
26
26
  gem.authors = ["David Chelimsky", "Chad Humphries"]
27
27
  gem.rubyforge_project = "rspec"
28
- gem.add_dependency "rspec", "2.0.0.beta.9" # gem.version
28
+ gem.add_dependency "rspec", gem.version
29
29
  gem.add_dependency "webrat", ">= 0.7.0"
30
30
  gem.post_install_message = <<-EOM
31
31
  #{"*"*50}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta.9.1
1
+ 2.0.0.beta.10
@@ -72,7 +72,32 @@ Feature: transactional examples
72
72
  it "has one after one was created in a previous example" do
73
73
  Widget.count.should == 1
74
74
  end
75
+
76
+ after(:all) { Widget.destroy_all }
75
77
  end
76
78
  """
77
79
  When I run "rspec spec/models/widget_spec.rb"
78
80
  Then I should see "3 examples, 0 failures"
81
+
82
+ Scenario: run in transactions with fixture
83
+ Given a file named "spec/models/thing_spec.rb" with:
84
+ """
85
+ require "spec_helper"
86
+
87
+ describe Thing do
88
+ fixtures :things
89
+ it "fixture method defined" do
90
+ things(:one)
91
+ end
92
+ end
93
+ """
94
+ Given a file named "spec/fixtures/things.yml" with:
95
+ """
96
+ one:
97
+ name: MyString
98
+ """
99
+ When I run "rspec spec/models/thing_spec.rb"
100
+ Then I should see "1 example, 0 failures"
101
+
102
+
103
+
@@ -17,7 +17,8 @@ module Rspec
17
17
  end
18
18
 
19
19
  def create_view_files
20
- return unless options[:views]
20
+ return if actions.empty?
21
+ return unless options[:views]
21
22
 
22
23
  empty_directory File.join("spec", "views", file_path)
23
24
 
@@ -11,20 +11,14 @@ DESC
11
11
  @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
12
12
  end
13
13
 
14
- def copy_initializer_files
15
- inside "config" do
16
- empty_directory "initializers", :verbose => false
17
-
18
- inside "initializers" do
19
- template "rspec_generator.rb.tt", "rspec_generator.rb"
20
- end
21
- end
22
- end
23
-
24
14
  def copy_spec_files
25
15
  directory 'spec'
26
16
  end
27
17
 
18
+ def copy_lib_files
19
+ directory 'lib'
20
+ end
21
+
28
22
  def copy_autotest_files
29
23
  directory 'autotest'
30
24
  end
@@ -66,3 +66,4 @@ namespace :spec do
66
66
  ::CodeStatistics::TEST_TYPES << "Request specs" if File.exist?('spec/requests')
67
67
  end
68
68
  end
69
+
@@ -18,6 +18,8 @@ Rspec.configure do |config|
18
18
  # config.mock_with :rr
19
19
  config.mock_with :rspec
20
20
 
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+
21
23
  # If you'd prefer not to run each of your examples within a transaction,
22
24
  # uncomment the following line.
23
25
  # config.use_transactional_examples = false
@@ -3,10 +3,6 @@ module RSpec
3
3
  class Railtie < ::Rails::Railtie
4
4
  config.generators.integration_tool :rspec
5
5
  config.generators.test_framework :rspec
6
-
7
- rake_tasks do
8
- load "rspec/rails/tasks/rspec.rake"
9
- end
10
6
  end
11
7
  end
12
- end
8
+ end
@@ -4,11 +4,8 @@ require 'rspec/rails/extensions'
4
4
  require 'rspec/rails/null_resolver'
5
5
  require 'rspec/rails/view_rendering'
6
6
  require 'rspec/rails/adapters'
7
- require 'rspec/rails/transactional_database_support'
8
7
  require 'rspec/rails/matchers'
9
- require 'rspec/rails/example'
8
+ require 'rspec/rails/fixture_support'
10
9
  require 'rspec/rails/mocks'
10
+ require 'rspec/rails/example'
11
11
 
12
- RSpec.configure do |c|
13
- c.add_option :use_transactional_examples, :type => :boolean, :default => true
14
- end
@@ -19,6 +19,9 @@ module RSpec
19
19
 
20
20
  module TestUnitAssertionAdapter
21
21
  extend ActiveSupport::Concern
22
+ def method_name
23
+ @running_example
24
+ end
22
25
 
23
26
  include Test::Unit::Assertions
24
27
 
@@ -0,0 +1,8 @@
1
+ module RSpec
2
+ module Rails
3
+ module Configuration
4
+ attr_accessor :fixture_path ,:global_fixtures
5
+ end
6
+ end
7
+ end
8
+
@@ -1,33 +1,35 @@
1
1
  require 'action_controller'
2
2
  require 'webrat'
3
3
 
4
- module ControllerExampleGroupBehaviour
5
- extend ActiveSupport::Concern
4
+ module RSpec::Rails
5
+ module ControllerExampleGroup
6
+ extend ActiveSupport::Concern
6
7
 
7
- include RSpec::Rails::SetupAndTeardownAdapter
8
- include RSpec::Rails::TestUnitAssertionAdapter
9
- include ActionController::TestCase::Behavior
10
- include RSpec::Rails::ViewRendering
11
- include Webrat::Matchers
12
- include Webrat::Methods
13
- include RSpec::Matchers
8
+ include RSpec::Rails::SetupAndTeardownAdapter
9
+ include RSpec::Rails::TestUnitAssertionAdapter
10
+ include ActionController::TestCase::Behavior
11
+ include RSpec::Rails::ViewRendering
12
+ include Webrat::Matchers
13
+ include Webrat::Methods
14
+ include RSpec::Matchers
14
15
 
15
- attr_reader :controller
16
+ attr_reader :controller
16
17
 
17
- module ClassMethods
18
- def controller_class
19
- describes
18
+ module ClassMethods
19
+ def controller_class
20
+ describes
21
+ end
20
22
  end
21
- end
22
23
 
23
- included do
24
- before do
25
- @routes = ::Rails.application.routes
26
- ActionController::Base.allow_forgery_protection = false
24
+ included do
25
+ before do
26
+ @routes = ::Rails.application.routes
27
+ ActionController::Base.allow_forgery_protection = false
28
+ end
27
29
  end
28
- end
29
30
 
30
- RSpec.configure do |c|
31
- c.include self, :example_group => { :file_path => /\bspec\/controllers\// }
31
+ RSpec.configure do |c|
32
+ c.include self, :example_group => { :file_path => /\bspec\/controllers\// }
33
+ end
32
34
  end
33
35
  end
@@ -1,43 +1,44 @@
1
1
  require 'webrat'
2
2
  require 'rspec/rails/view_assigns'
3
3
 
4
- module HelperExampleGroupBehaviour
5
- extend ActiveSupport::Concern
6
-
7
- include RSpec::Rails::SetupAndTeardownAdapter
8
- include RSpec::Rails::TestUnitAssertionAdapter
9
- include ActionView::TestCase::Behavior
10
- include RSpec::Rails::ViewAssigns
11
- include Webrat::Matchers
12
-
13
- module ClassMethods
14
- def determine_default_helper_class(ignore)
15
- describes
4
+ module RSpec::Rails
5
+ module HelperExampleGroup
6
+ extend ActiveSupport::Concern
7
+
8
+ include RSpec::Rails::SetupAndTeardownAdapter
9
+ include RSpec::Rails::TestUnitAssertionAdapter
10
+ include ActionView::TestCase::Behavior
11
+ include RSpec::Rails::ViewAssigns
12
+ include Webrat::Matchers
13
+
14
+ module ClassMethods
15
+ def determine_default_helper_class(ignore)
16
+ describes
17
+ end
16
18
  end
17
- end
18
19
 
19
- module InstanceMethods
20
- # Returns an instance of ActionView::Base instrumented with this helper and
21
- # any of the built-in rails helpers.
22
- def helper
23
- _view
24
- end
20
+ module InstanceMethods
21
+ # Returns an instance of ActionView::Base instrumented with this helper and
22
+ # any of the built-in rails helpers.
23
+ def helper
24
+ _view
25
+ end
25
26
 
26
- private
27
+ private
27
28
 
28
- def _controller_path
29
- running_example.example_group.describes.to_s.sub(/Helper/,'').underscore
29
+ def _controller_path
30
+ running_example.example_group.describes.to_s.sub(/Helper/,'').underscore
31
+ end
30
32
  end
31
- end
32
33
 
33
- included do
34
- before do
35
- controller.controller_path = _controller_path
34
+ included do
35
+ before do
36
+ controller.controller_path = _controller_path
37
+ end
36
38
  end
37
- end
38
39
 
39
- RSpec.configure do |c|
40
- c.include self, :example_group => { :file_path => /\bspec\/helpers\// }
40
+ RSpec.configure do |c|
41
+ c.include self, :example_group => { :file_path => /\bspec\/helpers\// }
42
+ end
41
43
  end
42
44
  end
43
-
@@ -1,27 +1,29 @@
1
1
  require 'webrat'
2
2
 
3
- module MailerExampleGroupBehaviour
4
- extend ActiveSupport::Concern
3
+ module RSpec::Rails
4
+ module MailerExampleGroup
5
+ extend ActiveSupport::Concern
5
6
 
6
- include Webrat::Matchers
7
- include RSpec::Matchers
7
+ include Webrat::Matchers
8
+ include RSpec::Matchers
8
9
 
9
- def read_fixture(action)
10
- IO.readlines(File.join(Rails.root, 'spec', 'fixtures', self.described_class.name.underscore, action))
11
- end
10
+ def read_fixture(action)
11
+ IO.readlines(File.join(Rails.root, 'spec', 'fixtures', self.described_class.name.underscore, action))
12
+ end
12
13
 
13
- included do
14
- before do
15
- ActionMailer::Base.delivery_method = :test
16
- ActionMailer::Base.perform_deliveries = true
17
- ActionMailer::Base.deliveries.clear
18
- @expected = Mail.new
19
- @expected.content_type ["text", "plain", { "charset" => "utf-8" }]
20
- @expected.mime_version = '1.0'
14
+ included do
15
+ before do
16
+ ActionMailer::Base.delivery_method = :test
17
+ ActionMailer::Base.perform_deliveries = true
18
+ ActionMailer::Base.deliveries.clear
19
+ @expected = Mail.new
20
+ @expected.content_type ["text", "plain", { "charset" => "utf-8" }]
21
+ @expected.mime_version = '1.0'
22
+ end
21
23
  end
22
- end
23
24
 
24
- RSpec.configure do |c|
25
- c.include self, :example_group => { :file_path => /\bspec\/mailers\// }
25
+ RSpec.configure do |c|
26
+ c.include self, :example_group => { :file_path => /\bspec\/mailers\// }
27
+ end
26
28
  end
27
29
  end
@@ -1,35 +1,37 @@
1
1
  require 'action_dispatch'
2
2
  require 'webrat'
3
3
 
4
- module RequestExampleGroupBehaviour
5
- extend ActiveSupport::Concern
4
+ module RSpec::Rails
5
+ module RequestExampleGroup
6
+ extend ActiveSupport::Concern
6
7
 
7
- include ActionDispatch::Integration::Runner
8
- include RSpec::Rails::TestUnitAssertionAdapter
9
- include ActionDispatch::Assertions
10
- include Webrat::Matchers
11
- include Webrat::Methods
12
- include RSpec::Matchers
8
+ include ActionDispatch::Integration::Runner
9
+ include RSpec::Rails::TestUnitAssertionAdapter
10
+ include ActionDispatch::Assertions
11
+ include Webrat::Matchers
12
+ include Webrat::Methods
13
+ include RSpec::Matchers
13
14
 
14
- included do
15
- before do
16
- @router = ::Rails.application.routes
15
+ included do
16
+ before do
17
+ @router = ::Rails.application.routes
18
+ end
19
+ end
20
+
21
+ def app
22
+ ::Rails.application
17
23
  end
18
- end
19
-
20
- def app
21
- ::Rails.application
22
- end
23
24
 
24
- def last_response
25
- response
26
- end
25
+ def last_response
26
+ response
27
+ end
27
28
 
28
- Webrat.configure do |config|
29
- config.mode = :rack
30
- end
29
+ Webrat.configure do |config|
30
+ config.mode = :rack
31
+ end
31
32
 
32
- RSpec.configure do |c|
33
- c.include self, :example_group => { :file_path => /\bspec\/requests\// }
33
+ RSpec.configure do |c|
34
+ c.include self, :example_group => { :file_path => /\bspec\/requests\// }
35
+ end
34
36
  end
35
37
  end
@@ -1,62 +1,64 @@
1
1
  require 'webrat'
2
2
  require 'rspec/rails/view_assigns'
3
3
 
4
- module ViewExampleGroupBehaviour
5
- extend ActiveSupport::Concern
6
-
7
- include RSpec::Rails::SetupAndTeardownAdapter
8
- include RSpec::Rails::TestUnitAssertionAdapter
9
- include ActionView::TestCase::Behavior
10
- include RSpec::Rails::ViewAssigns
11
- include Webrat::Matchers
12
-
13
- module InstanceMethods
14
- def response
15
- RSpec.deprecate("response", "rendered")
16
- rendered
17
- end
4
+ module RSpec::Rails
5
+ module ViewExampleGroup
6
+ extend ActiveSupport::Concern
18
7
 
19
- # :callseq:
20
- # render
21
- # render(:template => "widgets/new.html.erb")
22
- # render({:partial => "widgets/widget.html.erb"}, {... locals ...})
23
- # render({:partial => "widgets/widget.html.erb"}, {... locals ...}) do ... end
24
- #
25
- # Delegates to ActionView::Base#render, so see documentation on that for more
26
- # info.
27
- #
28
- # The only addition is that you can call render with no arguments, and RSpec
29
- # will pass the top level description to render:
30
- #
31
- # describe "widgets/new.html.erb" do
32
- # it "shows all the widgets" do
33
- # render # => view.render(:file => "widgets/new.html.erb")
34
- # ...
35
- # end
36
- # end
37
- def render(options={}, local_assigns={}, &block)
38
- options = {:template => _default_file_to_render} if Hash === options and options.empty?
39
- super(options, local_assigns, &block)
40
- end
8
+ include RSpec::Rails::SetupAndTeardownAdapter
9
+ include RSpec::Rails::TestUnitAssertionAdapter
10
+ include ActionView::TestCase::Behavior
11
+ include RSpec::Rails::ViewAssigns
12
+ include Webrat::Matchers
41
13
 
42
- private
14
+ module InstanceMethods
15
+ def response
16
+ RSpec.deprecate("response", "rendered")
17
+ rendered
18
+ end
43
19
 
44
- def _default_file_to_render
45
- running_example.example_group.top_level_description
46
- end
20
+ # :callseq:
21
+ # render
22
+ # render(:template => "widgets/new.html.erb")
23
+ # render({:partial => "widgets/widget.html.erb"}, {... locals ...})
24
+ # render({:partial => "widgets/widget.html.erb"}, {... locals ...}) do ... end
25
+ #
26
+ # Delegates to ActionView::Base#render, so see documentation on that for more
27
+ # info.
28
+ #
29
+ # The only addition is that you can call render with no arguments, and RSpec
30
+ # will pass the top level description to render:
31
+ #
32
+ # describe "widgets/new.html.erb" do
33
+ # it "shows all the widgets" do
34
+ # render # => view.render(:file => "widgets/new.html.erb")
35
+ # ...
36
+ # end
37
+ # end
38
+ def render(options={}, local_assigns={}, &block)
39
+ options = {:template => _default_file_to_render} if Hash === options and options.empty?
40
+ super(options, local_assigns, &block)
41
+ end
42
+
43
+ private
47
44
 
48
- def _controller_path
49
- _default_file_to_render.split("/")[0..-2].join("/")
45
+ def _default_file_to_render
46
+ running_example.example_group.top_level_description
47
+ end
48
+
49
+ def _controller_path
50
+ _default_file_to_render.split("/")[0..-2].join("/")
51
+ end
50
52
  end
51
- end
52
53
 
53
- included do
54
- before do
55
- controller.controller_path = _controller_path
54
+ included do
55
+ before do
56
+ controller.controller_path = _controller_path
57
+ end
56
58
  end
57
- end
58
59
 
59
- RSpec.configure do |c|
60
- c.include self, :example_group => { :file_path => /\bspec\/views\// }
60
+ RSpec.configure do |c|
61
+ c.include self, :example_group => { :file_path => /\bspec\/views\// }
62
+ end
61
63
  end
62
64
  end
@@ -0,0 +1,31 @@
1
+ module RSpec
2
+ module Rails
3
+ module FixtureSupport
4
+ extend ActiveSupport::Concern
5
+
6
+ include RSpec::Rails::SetupAndTeardownAdapter
7
+ include RSpec::Rails::TestUnitAssertionAdapter
8
+
9
+ included do
10
+ if RSpec.configuration.use_transactional_fixtures
11
+ # TODO - figure out how to move this outside the included block
12
+ include ActiveRecord::TestFixtures
13
+
14
+ self.fixture_path = RSpec.configuration.fixture_path
15
+ self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
16
+ self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
17
+ fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ RSpec.configure do |c|
25
+ c.include RSpec::Rails::FixtureSupport
26
+ c.add_setting :use_transactional_fixtures, :default => true
27
+ c.add_setting :use_transactional_examples, :alias => :use_transactional_fixtures
28
+ c.add_setting :use_instantiated_fixtures
29
+ c.add_setting :global_fixtures
30
+ c.add_setting :fixture_path
31
+ end
@@ -1,3 +1,5 @@
1
+ require 'rspec/core/deprecation'
2
+ require 'rspec/core/backward_compatibility'
1
3
  require 'rspec/matchers'
2
4
 
3
5
  begin
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rspec-rails}
8
- s.version = "2.0.0.beta.9.1"
8
+ s.version = "2.0.0.beta.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Chelimsky", "Chad Humphries"]
12
- s.date = %q{2010-05-27}
12
+ s.date = %q{2010-06-02}
13
13
  s.description = %q{RSpec-2 for Rails-3}
14
14
  s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  "lib/generators/rspec/helper/templates/helper_spec.rb",
44
44
  "lib/generators/rspec/install/install_generator.rb",
45
45
  "lib/generators/rspec/install/templates/autotest/discover.rb",
46
- "lib/generators/rspec/install/templates/config/initializers/rspec_generator.rb.tt",
46
+ "lib/generators/rspec/install/templates/lib/tasks/rspec.rake",
47
47
  "lib/generators/rspec/install/templates/spec/spec_helper.rb",
48
48
  "lib/generators/rspec/integration/integration_generator.rb",
49
49
  "lib/generators/rspec/integration/templates/request_spec.rb",
@@ -67,6 +67,7 @@ Gem::Specification.new do |s|
67
67
  "lib/rspec-rails.rb",
68
68
  "lib/rspec/rails.rb",
69
69
  "lib/rspec/rails/adapters.rb",
70
+ "lib/rspec/rails/configuration.rb",
70
71
  "lib/rspec/rails/example.rb",
71
72
  "lib/rspec/rails/example/controller_example_group.rb",
72
73
  "lib/rspec/rails/example/helper_example_group.rb",
@@ -75,6 +76,7 @@ Gem::Specification.new do |s|
75
76
  "lib/rspec/rails/example/view_example_group.rb",
76
77
  "lib/rspec/rails/extensions.rb",
77
78
  "lib/rspec/rails/extensions/active_record/base.rb",
79
+ "lib/rspec/rails/fixture_support.rb",
78
80
  "lib/rspec/rails/matchers.rb",
79
81
  "lib/rspec/rails/mocks.rb",
80
82
  "lib/rspec/rails/monkey.rb",
@@ -82,8 +84,6 @@ Gem::Specification.new do |s|
82
84
  "lib/rspec/rails/monkey/action_view/test_case.rb",
83
85
  "lib/rspec/rails/monkey/active_support/notifications/fanout.rb",
84
86
  "lib/rspec/rails/null_resolver.rb",
85
- "lib/rspec/rails/tasks/rspec.rake",
86
- "lib/rspec/rails/transactional_database_support.rb",
87
87
  "lib/rspec/rails/version.rb",
88
88
  "lib/rspec/rails/view_assigns.rb",
89
89
  "lib/rspec/rails/view_rendering.rb",
@@ -101,7 +101,6 @@ Gem::Specification.new do |s|
101
101
  "spec/rspec/rails/mocks/ar_classes.rb",
102
102
  "spec/rspec/rails/mocks/mock_model_spec.rb",
103
103
  "spec/rspec/rails/mocks/stub_model_spec.rb",
104
- "spec/rspec/rails/transactional_database_support_spec.rb",
105
104
  "spec/spec_helper.rb",
106
105
  "spec/support/helpers.rb",
107
106
  "specs.watchr",
@@ -111,7 +110,7 @@ Gem::Specification.new do |s|
111
110
  s.homepage = %q{http://github.com/rspec/rspec-rails}
112
111
  s.post_install_message = %q{**************************************************
113
112
 
114
- Thank you for installing rspec-rails-2.0.0.beta.9.1!
113
+ Thank you for installing rspec-rails-2.0.0.beta.10!
115
114
 
116
115
  This version of rspec-rails only works with
117
116
  versions of rails >= 3.0.0.pre.
@@ -126,7 +125,7 @@ Gem::Specification.new do |s|
126
125
  s.require_paths = ["lib"]
127
126
  s.rubyforge_project = %q{rspec}
128
127
  s.rubygems_version = %q{1.3.6}
129
- s.summary = %q{rspec-rails-2.0.0.beta.9.1}
128
+ s.summary = %q{rspec-rails-2.0.0.beta.10}
130
129
  s.test_files = [
131
130
  "spec/rspec/rails/example/controller_example_group_spec.rb",
132
131
  "spec/rspec/rails/example/helper_example_group_spec.rb",
@@ -141,7 +140,6 @@ Gem::Specification.new do |s|
141
140
  "spec/rspec/rails/mocks/ar_classes.rb",
142
141
  "spec/rspec/rails/mocks/mock_model_spec.rb",
143
142
  "spec/rspec/rails/mocks/stub_model_spec.rb",
144
- "spec/rspec/rails/transactional_database_support_spec.rb",
145
143
  "spec/spec_helper.rb",
146
144
  "spec/support/helpers.rb"
147
145
  ]
@@ -151,14 +149,14 @@ Gem::Specification.new do |s|
151
149
  s.specification_version = 3
152
150
 
153
151
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
154
- s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.9"])
152
+ s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.10"])
155
153
  s.add_runtime_dependency(%q<webrat>, [">= 0.7.0"])
156
154
  else
157
- s.add_dependency(%q<rspec>, ["= 2.0.0.beta.9"])
155
+ s.add_dependency(%q<rspec>, ["= 2.0.0.beta.10"])
158
156
  s.add_dependency(%q<webrat>, [">= 0.7.0"])
159
157
  end
160
158
  else
161
- s.add_dependency(%q<rspec>, ["= 2.0.0.beta.9"])
159
+ s.add_dependency(%q<rspec>, ["= 2.0.0.beta.10"])
162
160
  s.add_dependency(%q<webrat>, [">= 0.7.0"])
163
161
  end
164
162
  end
@@ -1,11 +1,13 @@
1
1
  require "spec_helper"
2
2
 
3
- describe ControllerExampleGroupBehaviour do
4
- it "is included in specs in ./spec/controllers" do
5
- stub_metadata(
6
- :example_group => {:file_path => "./spec/controllers/whatever_spec.rb:15"}
7
- )
8
- group = RSpec::Core::ExampleGroup.describe
9
- group.included_modules.should include(ControllerExampleGroupBehaviour)
3
+ module RSpec::Rails
4
+ describe ControllerExampleGroup do
5
+ it "is included in specs in ./spec/controllers" do
6
+ stub_metadata(
7
+ :example_group => {:file_path => "./spec/controllers/whatever_spec.rb:15"}
8
+ )
9
+ group = RSpec::Core::ExampleGroup.describe
10
+ group.included_modules.should include(ControllerExampleGroup)
11
+ end
10
12
  end
11
13
  end
@@ -1,20 +1,22 @@
1
1
  require "spec_helper"
2
2
 
3
- describe HelperExampleGroupBehaviour do
4
- it "is included in specs in ./spec/views" do
5
- stub_metadata(
6
- :example_group => {:file_path => "./spec/helpers/whatever_spec.rb:15"}
7
- )
8
- group = RSpec::Core::ExampleGroup.describe
9
- group.included_modules.should include(HelperExampleGroupBehaviour)
10
- end
3
+ module RSpec::Rails
4
+ describe HelperExampleGroup do
5
+ it "is included in specs in ./spec/views" do
6
+ stub_metadata(
7
+ :example_group => {:file_path => "./spec/helpers/whatever_spec.rb:15"}
8
+ )
9
+ group = RSpec::Core::ExampleGroup.describe
10
+ group.included_modules.should include(HelperExampleGroup)
11
+ end
11
12
 
12
- module ::FoosHelper; end
13
+ module ::FoosHelper; end
13
14
 
14
- it "provides a controller_path based on the helper module's name" do
15
- helper_spec = Object.new
16
- helper_spec.extend HelperExampleGroupBehaviour::InstanceMethods
17
- helper_spec.stub_chain(:running_example, :example_group, :describes).and_return(FoosHelper)
18
- helper_spec.__send__(:_controller_path).should == "foos"
15
+ it "provides a controller_path based on the helper module's name" do
16
+ helper_spec = Object.new
17
+ helper_spec.extend HelperExampleGroup::InstanceMethods
18
+ helper_spec.stub_chain(:running_example, :example_group, :describes).and_return(FoosHelper)
19
+ helper_spec.__send__(:_controller_path).should == "foos"
20
+ end
19
21
  end
20
22
  end
@@ -1,11 +1,13 @@
1
1
  require "spec_helper"
2
2
 
3
- describe MailerExampleGroupBehaviour do
4
- it "is included in specs in ./spec/mailers" do
5
- stub_metadata(
6
- :example_group => {:file_path => "./spec/mailers/whatever_spec.rb:15"}
7
- )
8
- group = RSpec::Core::ExampleGroup.describe
9
- group.included_modules.should include(MailerExampleGroupBehaviour)
3
+ module RSpec::Rails
4
+ describe MailerExampleGroup do
5
+ it "is included in specs in ./spec/mailers" do
6
+ stub_metadata(
7
+ :example_group => {:file_path => "./spec/mailers/whatever_spec.rb:15"}
8
+ )
9
+ group = RSpec::Core::ExampleGroup.describe
10
+ group.included_modules.should include(MailerExampleGroup)
11
+ end
10
12
  end
11
13
  end
@@ -1,11 +1,13 @@
1
1
  require "spec_helper"
2
2
 
3
- describe RequestExampleGroupBehaviour do
4
- it "is included in specs in ./spec/requests" do
5
- stub_metadata(
6
- :example_group => {:file_path => "./spec/requests/whatever_spec.rb:15"}
7
- )
8
- group = RSpec::Core::ExampleGroup.describe
9
- group.included_modules.should include(RequestExampleGroupBehaviour)
3
+ module RSpec::Rails
4
+ describe RequestExampleGroup do
5
+ it "is included in specs in ./spec/requests" do
6
+ stub_metadata(
7
+ :example_group => {:file_path => "./spec/requests/whatever_spec.rb:15"}
8
+ )
9
+ group = RSpec::Core::ExampleGroup.describe
10
+ group.included_modules.should include(RequestExampleGroup)
11
+ end
10
12
  end
11
13
  end
@@ -1,74 +1,76 @@
1
1
  require "spec_helper"
2
2
 
3
- describe ViewExampleGroupBehaviour do
4
- it "is included in specs in ./spec/views" do
5
- stub_metadata(
6
- :example_group => {:file_path => "./spec/views/whatever_spec.rb:15"}
7
- )
8
- group = RSpec::Core::ExampleGroup.describe
9
- group.included_modules.should include(ViewExampleGroupBehaviour)
10
- end
3
+ module RSpec::Rails
4
+ describe ViewExampleGroup do
5
+ it "is included in specs in ./spec/views" do
6
+ stub_metadata(
7
+ :example_group => {:file_path => "./spec/views/whatever_spec.rb:15"}
8
+ )
9
+ group = RSpec::Core::ExampleGroup.describe
10
+ group.included_modules.should include(ViewExampleGroup)
11
+ end
11
12
 
12
- describe "#render" do
13
- let(:view_spec) do
14
- Class.new do
15
- module Local
16
- def received
17
- @received ||= []
18
- end
19
- def render(options={}, local_assigns={}, &block)
20
- received << [options, local_assigns, block]
13
+ describe "#render" do
14
+ let(:view_spec) do
15
+ Class.new do
16
+ module Local
17
+ def received
18
+ @received ||= []
19
+ end
20
+ def render(options={}, local_assigns={}, &block)
21
+ received << [options, local_assigns, block]
22
+ end
21
23
  end
22
- end
23
- include Local
24
- include ViewExampleGroupBehaviour::InstanceMethods
25
- end.new
26
- end
24
+ include Local
25
+ include ViewExampleGroup::InstanceMethods
26
+ end.new
27
+ end
27
28
 
28
- context "given no input" do
29
- it "sends render(:file => (described file)) to the view" do
30
- view_spec.stub(:_default_file_to_render) { "widgets/new.html.erb" }
31
- view_spec.render
32
- view_spec.received.first.should == [{:template => "widgets/new.html.erb"},{}, nil]
29
+ context "given no input" do
30
+ it "sends render(:file => (described file)) to the view" do
31
+ view_spec.stub(:_default_file_to_render) { "widgets/new.html.erb" }
32
+ view_spec.render
33
+ view_spec.received.first.should == [{:template => "widgets/new.html.erb"},{}, nil]
34
+ end
33
35
  end
34
- end
35
36
 
36
- context "given a string" do
37
- it "sends string as the first arg to render" do
38
- view_spec.render('arbitrary/path')
39
- view_spec.received.first.should == ["arbitrary/path", {}, nil]
37
+ context "given a string" do
38
+ it "sends string as the first arg to render" do
39
+ view_spec.render('arbitrary/path')
40
+ view_spec.received.first.should == ["arbitrary/path", {}, nil]
41
+ end
40
42
  end
41
- end
42
43
 
43
- context "given a hash" do
44
- it "sends the hash as the first arg to render" do
45
- view_spec.render(:foo => 'bar')
46
- view_spec.received.first.should == [{:foo => "bar"}, {}, nil]
44
+ context "given a hash" do
45
+ it "sends the hash as the first arg to render" do
46
+ view_spec.render(:foo => 'bar')
47
+ view_spec.received.first.should == [{:foo => "bar"}, {}, nil]
48
+ end
47
49
  end
48
50
  end
49
- end
50
51
 
51
- describe "#_controller_path" do
52
- let(:view_spec) do
53
- Class.new do
54
- include ViewExampleGroupBehaviour::InstanceMethods
55
- end.new
56
- end
57
- context "with a common _default_file_to_render" do
58
- it "it returns the directory" do
59
- view_spec.stub(:_default_file_to_render).
60
- and_return("things/new.html.erb")
61
- view_spec.__send__(:_controller_path).
62
- should == "things"
52
+ describe "#_controller_path" do
53
+ let(:view_spec) do
54
+ Class.new do
55
+ include ViewExampleGroup::InstanceMethods
56
+ end.new
57
+ end
58
+ context "with a common _default_file_to_render" do
59
+ it "it returns the directory" do
60
+ view_spec.stub(:_default_file_to_render).
61
+ and_return("things/new.html.erb")
62
+ view_spec.__send__(:_controller_path).
63
+ should == "things"
64
+ end
63
65
  end
64
- end
65
66
 
66
- context "with a nested _default_file_to_render" do
67
- it "it returns the directory path" do
68
- view_spec.stub(:_default_file_to_render).
69
- and_return("admin/things/new.html.erb")
70
- view_spec.__send__(:_controller_path).
71
- should == "admin/things"
67
+ context "with a nested _default_file_to_render" do
68
+ it "it returns the directory path" do
69
+ view_spec.stub(:_default_file_to_render).
70
+ and_return("admin/things/new.html.erb")
71
+ view_spec.__send__(:_controller_path).
72
+ should == "admin/things"
73
+ end
72
74
  end
73
75
  end
74
76
  end
@@ -1,68 +1,69 @@
1
1
  require "spec_helper"
2
2
 
3
- describe RSpec::Rails::ViewRendering do
4
- it "doesn't render views by default" do
5
- rendering_views = nil
6
- group = RSpec::Core::ExampleGroup.describe do
7
- include ControllerExampleGroupBehaviour
8
- rendering_views = render_views?
9
- it("does something") {}
10
- end
11
- group.run(double.as_null_object)
12
- rendering_views.should be_false
13
- end
14
-
15
- it "doesn't render views by default in a nested group" do
16
- rendering_views = nil
17
- group = RSpec::Core::ExampleGroup.describe do
18
- include ControllerExampleGroupBehaviour
19
- describe "nested" do
3
+ module RSpec::Rails
4
+ describe ViewRendering do
5
+ it "doesn't render views by default" do
6
+ rendering_views = nil
7
+ group = RSpec::Core::ExampleGroup.describe do
8
+ include ControllerExampleGroup
20
9
  rendering_views = render_views?
21
10
  it("does something") {}
22
11
  end
12
+ group.run(double.as_null_object)
13
+ rendering_views.should be_false
23
14
  end
24
- group.run(double.as_null_object)
25
- rendering_views.should be_false
26
- end
27
15
 
28
- it "renders views if told to" do
29
- rendering_views = false
30
- group = RSpec::Core::ExampleGroup.describe do
31
- include ControllerExampleGroupBehaviour
32
- render_views
33
- rendering_views = render_views?
34
- it("does something") {}
16
+ it "doesn't render views by default in a nested group" do
17
+ rendering_views = nil
18
+ group = RSpec::Core::ExampleGroup.describe do
19
+ include ControllerExampleGroup
20
+ describe "nested" do
21
+ rendering_views = render_views?
22
+ it("does something") {}
23
+ end
24
+ end
25
+ group.run(double.as_null_object)
26
+ rendering_views.should be_false
35
27
  end
36
- group.run(double.as_null_object)
37
- rendering_views.should be_true
38
- end
39
28
 
40
- it "renders views if told to in a nested group" do
41
- rendering_views = nil
42
- group = RSpec::Core::ExampleGroup.describe do
43
- include ControllerExampleGroupBehaviour
44
- describe "nested" do
29
+ it "renders views if told to" do
30
+ rendering_views = false
31
+ group = RSpec::Core::ExampleGroup.describe do
32
+ include ControllerExampleGroup
45
33
  render_views
46
34
  rendering_views = render_views?
47
35
  it("does something") {}
48
36
  end
37
+ group.run(double.as_null_object)
38
+ rendering_views.should be_true
49
39
  end
50
- group.run(double.as_null_object)
51
- rendering_views.should be_true
52
- end
53
40
 
54
- it "renders views in a nested group if told to in an outer group" do
55
- rendering_views = nil
56
- group = RSpec::Core::ExampleGroup.describe do
57
- include ControllerExampleGroupBehaviour
58
- render_views
59
- describe "nested" do
60
- rendering_views = render_views?
61
- it("does something") {}
41
+ it "renders views if told to in a nested group" do
42
+ rendering_views = nil
43
+ group = RSpec::Core::ExampleGroup.describe do
44
+ include ControllerExampleGroup
45
+ describe "nested" do
46
+ render_views
47
+ rendering_views = render_views?
48
+ it("does something") {}
49
+ end
62
50
  end
51
+ group.run(double.as_null_object)
52
+ rendering_views.should be_true
53
+ end
54
+
55
+ it "renders views in a nested group if told to in an outer group" do
56
+ rendering_views = nil
57
+ group = RSpec::Core::ExampleGroup.describe do
58
+ include ControllerExampleGroup
59
+ render_views
60
+ describe "nested" do
61
+ rendering_views = render_views?
62
+ it("does something") {}
63
+ end
64
+ end
65
+ group.run(double.as_null_object)
66
+ rendering_views.should be_true
63
67
  end
64
- group.run(double.as_null_object)
65
- rendering_views.should be_true
66
68
  end
67
69
  end
68
-
metadata CHANGED
@@ -7,9 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 0
9
9
  - beta
10
- - 9
11
- - 1
12
- version: 2.0.0.beta.9.1
10
+ - 10
11
+ version: 2.0.0.beta.10
13
12
  platform: ruby
14
13
  authors:
15
14
  - David Chelimsky
@@ -18,7 +17,7 @@ autorequire:
18
17
  bindir: bin
19
18
  cert_chain: []
20
19
 
21
- date: 2010-05-27 00:00:00 -05:00
20
+ date: 2010-06-02 00:00:00 -05:00
22
21
  default_executable:
23
22
  dependencies:
24
23
  - !ruby/object:Gem::Dependency
@@ -33,8 +32,8 @@ dependencies:
33
32
  - 0
34
33
  - 0
35
34
  - beta
36
- - 9
37
- version: 2.0.0.beta.9
35
+ - 10
36
+ version: 2.0.0.beta.10
38
37
  type: :runtime
39
38
  version_requirements: *id001
40
39
  - !ruby/object:Gem::Dependency
@@ -87,7 +86,7 @@ files:
87
86
  - lib/generators/rspec/helper/templates/helper_spec.rb
88
87
  - lib/generators/rspec/install/install_generator.rb
89
88
  - lib/generators/rspec/install/templates/autotest/discover.rb
90
- - lib/generators/rspec/install/templates/config/initializers/rspec_generator.rb.tt
89
+ - lib/generators/rspec/install/templates/lib/tasks/rspec.rake
91
90
  - lib/generators/rspec/install/templates/spec/spec_helper.rb
92
91
  - lib/generators/rspec/integration/integration_generator.rb
93
92
  - lib/generators/rspec/integration/templates/request_spec.rb
@@ -111,6 +110,7 @@ files:
111
110
  - lib/rspec-rails.rb
112
111
  - lib/rspec/rails.rb
113
112
  - lib/rspec/rails/adapters.rb
113
+ - lib/rspec/rails/configuration.rb
114
114
  - lib/rspec/rails/example.rb
115
115
  - lib/rspec/rails/example/controller_example_group.rb
116
116
  - lib/rspec/rails/example/helper_example_group.rb
@@ -119,6 +119,7 @@ files:
119
119
  - lib/rspec/rails/example/view_example_group.rb
120
120
  - lib/rspec/rails/extensions.rb
121
121
  - lib/rspec/rails/extensions/active_record/base.rb
122
+ - lib/rspec/rails/fixture_support.rb
122
123
  - lib/rspec/rails/matchers.rb
123
124
  - lib/rspec/rails/mocks.rb
124
125
  - lib/rspec/rails/monkey.rb
@@ -126,8 +127,6 @@ files:
126
127
  - lib/rspec/rails/monkey/action_view/test_case.rb
127
128
  - lib/rspec/rails/monkey/active_support/notifications/fanout.rb
128
129
  - lib/rspec/rails/null_resolver.rb
129
- - lib/rspec/rails/tasks/rspec.rake
130
- - lib/rspec/rails/transactional_database_support.rb
131
130
  - lib/rspec/rails/version.rb
132
131
  - lib/rspec/rails/view_assigns.rb
133
132
  - lib/rspec/rails/view_rendering.rb
@@ -145,7 +144,6 @@ files:
145
144
  - spec/rspec/rails/mocks/ar_classes.rb
146
145
  - spec/rspec/rails/mocks/mock_model_spec.rb
147
146
  - spec/rspec/rails/mocks/stub_model_spec.rb
148
- - spec/rspec/rails/transactional_database_support_spec.rb
149
147
  - spec/spec_helper.rb
150
148
  - spec/support/helpers.rb
151
149
  - specs.watchr
@@ -158,7 +156,7 @@ licenses: []
158
156
  post_install_message: |
159
157
  **************************************************
160
158
 
161
- Thank you for installing rspec-rails-2.0.0.beta.9.1!
159
+ Thank you for installing rspec-rails-2.0.0.beta.10!
162
160
 
163
161
  This version of rspec-rails only works with
164
162
  versions of rails >= 3.0.0.pre.
@@ -195,7 +193,7 @@ rubyforge_project: rspec
195
193
  rubygems_version: 1.3.6
196
194
  signing_key:
197
195
  specification_version: 3
198
- summary: rspec-rails-2.0.0.beta.9.1
196
+ summary: rspec-rails-2.0.0.beta.10
199
197
  test_files:
200
198
  - spec/rspec/rails/example/controller_example_group_spec.rb
201
199
  - spec/rspec/rails/example/helper_example_group_spec.rb
@@ -210,6 +208,5 @@ test_files:
210
208
  - spec/rspec/rails/mocks/ar_classes.rb
211
209
  - spec/rspec/rails/mocks/mock_model_spec.rb
212
210
  - spec/rspec/rails/mocks/stub_model_spec.rb
213
- - spec/rspec/rails/transactional_database_support_spec.rb
214
211
  - spec/spec_helper.rb
215
212
  - spec/support/helpers.rb
@@ -1,6 +0,0 @@
1
- <%= app_name %>.configure do
2
- config.generators do |g|
3
- g.integration_tool :rspec
4
- g.test_framework :rspec
5
- end
6
- end
@@ -1,40 +0,0 @@
1
- module RSpec
2
- module Rails
3
- module TransactionalDatabaseSupport
4
-
5
- def active_record_configured?
6
- defined?(::ActiveRecord) && !::ActiveRecord::Base.configurations.blank?
7
- end
8
-
9
- def use_transactional_examples?
10
- active_record_configured? && RSpec.configuration.use_transactional_examples?
11
- end
12
-
13
- def setup_transactional_examples
14
- return unless use_transactional_examples?
15
-
16
- ::ActiveRecord::Base.connection.increment_open_transactions
17
- ::ActiveRecord::Base.connection.begin_db_transaction
18
- end
19
-
20
- def teardown_transactional_examples
21
- return unless use_transactional_examples?
22
-
23
- if ::ActiveRecord::Base.connection.open_transactions != 0
24
- ::ActiveRecord::Base.connection.rollback_db_transaction
25
- ::ActiveRecord::Base.connection.decrement_open_transactions
26
- end
27
-
28
- ::ActiveRecord::Base.clear_active_connections!
29
- end
30
-
31
- end
32
- end
33
- end
34
-
35
- RSpec.configure do |c|
36
- c.include RSpec::Rails::TransactionalDatabaseSupport
37
- c.before { setup_transactional_examples }
38
- c.after { teardown_transactional_examples }
39
- end
40
-
@@ -1,54 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RSpec::Rails::TransactionalDatabaseSupport do
4
-
5
- let(:connection) { double('connection', :open_transactions => 1) }
6
- let(:test_bed) do
7
- Class.new do
8
- include RSpec::Rails::TransactionalDatabaseSupport
9
- def active_record_configured?; true; end
10
- end.new
11
- end
12
-
13
- before { ::ActiveRecord::Base.stub(:connection) { connection } }
14
-
15
- describe "#setup_transactional_examples" do
16
- context 'when running with examples with transactions' do
17
- it "opens a new transaction" do
18
- test_bed.stub(:use_transactional_examples?) { true }
19
- connection.should_receive(:increment_open_transactions)
20
- connection.should_receive(:begin_db_transaction)
21
- test_bed.setup_transactional_examples
22
- end
23
- end
24
-
25
- context 'with transactionless examples' do
26
- it "doesn't open a transaction" do
27
- test_bed.stub(:use_transactional_examples?) { false }
28
- connection.should_not_receive(:increment_open_transactions)
29
- connection.should_not_receive(:begin_db_transaction)
30
- test_bed.setup_transactional_examples
31
- end
32
- end
33
- end
34
-
35
- describe "#teardown_transactional_examples" do
36
- context 'when running with examples with transactions' do
37
- it "opens a new transaction" do
38
- test_bed.stub(:use_transactional_examples?) { true }
39
- connection.should_receive(:rollback_db_transaction)
40
- connection.should_receive(:decrement_open_transactions)
41
- test_bed.teardown_transactional_examples
42
- end
43
- end
44
-
45
- context 'with transactionless examples' do
46
- it "doesn't close an open transaction" do
47
- test_bed.stub(:use_transactional_examples?) { false }
48
- connection.should_not_receive(:decrement_open_transactions)
49
- connection.should_not_receive(:rollback_db_transaction)
50
- test_bed.teardown_transactional_examples
51
- end
52
- end
53
- end
54
- end