rspec-rails 2.13.1 → 2.13.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +12 -1
  3. data/README.md +1 -1
  4. data/lib/generators/rspec.rb +1 -2
  5. data/lib/generators/rspec/install/install_generator.rb +0 -2
  6. data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +1 -1
  7. data/lib/generators/rspec/scaffold/templates/controller_spec.rb +1 -1
  8. data/lib/rspec/rails.rb +1 -1
  9. data/lib/rspec/rails/example/controller_example_group.rb +4 -2
  10. data/lib/rspec/rails/example/rails_example_group.rb +1 -2
  11. data/lib/rspec/rails/example/view_example_group.rb +1 -1
  12. data/lib/rspec/rails/fixture_support.rb +1 -1
  13. data/lib/rspec/rails/version.rb +1 -1
  14. metadata +5 -182
  15. data/features/Autotest.md +0 -24
  16. data/features/Generators.md +0 -8
  17. data/features/GettingStarted.md +0 -84
  18. data/features/README.md +0 -56
  19. data/features/RailsVersions.md +0 -4
  20. data/features/Transactions.md +0 -84
  21. data/features/Upgrade.md +0 -121
  22. data/features/controller_specs/Cookies.md +0 -57
  23. data/features/controller_specs/README.md +0 -45
  24. data/features/controller_specs/anonymous_controller.feature +0 -378
  25. data/features/controller_specs/bypass_rescue.feature +0 -75
  26. data/features/controller_specs/controller_spec.feature +0 -35
  27. data/features/controller_specs/engine_routes.feature +0 -51
  28. data/features/controller_specs/isolation_from_views.feature +0 -87
  29. data/features/controller_specs/render_views.feature +0 -114
  30. data/features/feature_specs/feature_spec.feature +0 -34
  31. data/features/helper_specs/helper_spec.feature +0 -122
  32. data/features/mailer_specs/url_helpers.feature +0 -38
  33. data/features/matchers/README.md +0 -18
  34. data/features/matchers/new_record_matcher.feature +0 -41
  35. data/features/matchers/redirect_to_matcher.feature +0 -40
  36. data/features/matchers/relation_match_array.feature +0 -22
  37. data/features/matchers/render_template_matcher.feature +0 -49
  38. data/features/mocks/mock_model.feature +0 -147
  39. data/features/mocks/stub_model.feature +0 -58
  40. data/features/model_specs/README.md +0 -21
  41. data/features/model_specs/errors_on.feature +0 -51
  42. data/features/model_specs/transactional_examples.feature +0 -109
  43. data/features/request_specs/request_spec.feature +0 -49
  44. data/features/routing_specs/README.md +0 -16
  45. data/features/routing_specs/be_routable_matcher.feature +0 -80
  46. data/features/routing_specs/engine_routes.feature +0 -38
  47. data/features/routing_specs/named_routes.feature +0 -18
  48. data/features/routing_specs/route_to_matcher.feature +0 -90
  49. data/features/step_definitions/additional_cli_steps.rb +0 -4
  50. data/features/step_definitions/model_steps.rb +0 -3
  51. data/features/support/env.rb +0 -53
  52. data/features/support/rails_versions.rb +0 -4
  53. data/features/view_specs/inferred_controller_path.feature +0 -45
  54. data/features/view_specs/stub_template.feature +0 -51
  55. data/features/view_specs/view_spec.feature +0 -206
  56. data/lib/rspec/rails/rails_version.rb +0 -17
  57. data/spec/autotest/rails_rspec2_spec.rb +0 -36
  58. data/spec/generators/rspec/controller/controller_generator_spec.rb +0 -97
  59. data/spec/generators/rspec/helper/helper_generator_spec.rb +0 -30
  60. data/spec/generators/rspec/install/install_generator_spec.rb +0 -30
  61. data/spec/generators/rspec/integration/integration_generator_spec.rb +0 -44
  62. data/spec/generators/rspec/mailer/mailer_generator_spec.rb +0 -48
  63. data/spec/generators/rspec/model/model_generator_spec.rb +0 -52
  64. data/spec/generators/rspec/observer/observer_generator_spec.rb +0 -21
  65. data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +0 -138
  66. data/spec/generators/rspec/view/view_generator_spec.rb +0 -41
  67. data/spec/rspec/rails/assertion_adapter_spec.rb +0 -28
  68. data/spec/rspec/rails/assertion_delegator_spec.rb +0 -43
  69. data/spec/rspec/rails/configuration_spec.rb +0 -26
  70. data/spec/rspec/rails/deprecations_spec.rb +0 -18
  71. data/spec/rspec/rails/example/controller_example_group_spec.rb +0 -100
  72. data/spec/rspec/rails/example/feature_example_group_spec.rb +0 -56
  73. data/spec/rspec/rails/example/helper_example_group_spec.rb +0 -64
  74. data/spec/rspec/rails/example/mailer_example_group_spec.rb +0 -21
  75. data/spec/rspec/rails/example/model_example_group_spec.rb +0 -15
  76. data/spec/rspec/rails/example/request_example_group_spec.rb +0 -17
  77. data/spec/rspec/rails/example/routing_example_group_spec.rb +0 -32
  78. data/spec/rspec/rails/example/view_example_group_spec.rb +0 -220
  79. data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +0 -23
  80. data/spec/rspec/rails/extensions/active_record/base_spec.rb +0 -42
  81. data/spec/rspec/rails/extensions/active_record/records_spec.rb +0 -9
  82. data/spec/rspec/rails/fixture_support_spec.rb +0 -17
  83. data/spec/rspec/rails/matchers/be_a_new_spec.rb +0 -142
  84. data/spec/rspec/rails/matchers/be_new_record_spec.rb +0 -33
  85. data/spec/rspec/rails/matchers/be_routable_spec.rb +0 -41
  86. data/spec/rspec/rails/matchers/be_valid_spec.rb +0 -44
  87. data/spec/rspec/rails/matchers/errors_on_spec.rb +0 -38
  88. data/spec/rspec/rails/matchers/has_spec.rb +0 -29
  89. data/spec/rspec/rails/matchers/have_rendered_spec.rb +0 -93
  90. data/spec/rspec/rails/matchers/redirect_to_spec.rb +0 -80
  91. data/spec/rspec/rails/matchers/relation_match_array_spec.rb +0 -31
  92. data/spec/rspec/rails/matchers/route_to_spec.rb +0 -151
  93. data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +0 -22
  94. data/spec/rspec/rails/mocks/mock_model_spec.rb +0 -379
  95. data/spec/rspec/rails/mocks/stub_model_spec.rb +0 -154
  96. data/spec/rspec/rails/rails_version_spec.rb +0 -29
  97. data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +0 -32
  98. data/spec/rspec/rails/view_rendering_spec.rb +0 -111
  99. data/spec/spec_helper.rb +0 -31
  100. data/spec/support/ar_classes.rb +0 -42
  101. data/spec/support/helpers.rb +0 -20
  102. data/spec/support/matchers.rb +0 -9
  103. data/spec/support/null_object.rb +0 -6
@@ -1,109 +0,0 @@
1
- Feature: transactional examples
2
-
3
- By default rspec executes each individual example in a transaction.
4
-
5
- You can also explicitly enable/disable transactions the configuration
6
- property 'use_transactional_examples'.
7
-
8
- Scenario: run in transactions (default)
9
- Given a file named "spec/models/widget_spec.rb" with:
10
- """ruby
11
- require "spec_helper"
12
-
13
- describe Widget do
14
- it "has none to begin with" do
15
- expect(Widget.count).to eq 0
16
- end
17
-
18
- it "has one after adding one" do
19
- Widget.create
20
- expect(Widget.count).to eq 1
21
- end
22
-
23
- it "has none after one was created in a previous example" do
24
- expect(Widget.count).to eq 0
25
- end
26
- end
27
- """
28
- When I run `rspec spec/models/widget_spec.rb`
29
- Then the examples should all pass
30
-
31
- Scenario: run in transactions (explicit)
32
- Given a file named "spec/models/widget_spec.rb" with:
33
- """ruby
34
- require "spec_helper"
35
-
36
- RSpec.configure do |c|
37
- c.use_transactional_examples = true
38
- end
39
-
40
- describe Widget do
41
- it "has none to begin with" do
42
- expect(Widget.count).to eq 0
43
- end
44
-
45
- it "has one after adding one" do
46
- Widget.create
47
- expect(Widget.count).to eq 1
48
- end
49
-
50
- it "has none after one was created in a previous example" do
51
- expect(Widget.count).to eq 0
52
- end
53
- end
54
- """
55
- When I run `rspec spec/models/widget_spec.rb`
56
- Then the examples should all pass
57
-
58
- Scenario: disable transactions (explicit)
59
- Given a file named "spec/models/widget_spec.rb" with:
60
- """ruby
61
- require "spec_helper"
62
-
63
- RSpec.configure do |c|
64
- c.use_transactional_examples = false
65
- c.order = "default"
66
- end
67
-
68
- describe Widget do
69
- it "has none to begin with" do
70
- expect(Widget.count).to eq 0
71
- end
72
-
73
- it "has one after adding one" do
74
- Widget.create
75
- expect(Widget.count).to eq 1
76
- end
77
-
78
- it "has one after one was created in a previous example" do
79
- expect(Widget.count).to eq 1
80
- end
81
-
82
- after(:all) { Widget.destroy_all }
83
- end
84
- """
85
- When I run `rspec spec/models/widget_spec.rb`
86
- Then the examples should all pass
87
-
88
- Scenario: run in transactions with fixture
89
- Given a file named "spec/models/thing_spec.rb" with:
90
- """ruby
91
- require "spec_helper"
92
-
93
- describe Thing do
94
- fixtures :things
95
- it "fixture method defined" do
96
- things(:one)
97
- end
98
- end
99
- """
100
- Given a file named "spec/fixtures/things.yml" with:
101
- """
102
- one:
103
- name: MyString
104
- """
105
- When I run `rspec spec/models/thing_spec.rb`
106
- Then the examples should all pass
107
-
108
-
109
-
@@ -1,49 +0,0 @@
1
- Feature: request spec
2
-
3
- Request specs provide a thin wrapper around Rails' integration tests, and are
4
- designed to drive behavior through the full stack, including routing
5
- (provided by Rails) and without stubbing (that's up to you).
6
-
7
- With request specs, you can:
8
-
9
- * specify a single request
10
- * specify multiple requests across multiple controllers
11
- * specify multiple requests across multiple sessions
12
-
13
- Check the rails documentation on integration tests for more information.
14
-
15
- RSpec provides two matchers that delegate to Rails assertions:
16
-
17
- render_template # delegates to assert_template
18
- redirect_to # delegates to assert_redirected_to
19
-
20
- Check the Rails docs for details on these methods as well.
21
-
22
- [Capybara](http://github.com/jnicklas/capybara) is no longer supported in
23
- request specs as of Capybara 2.0.0. The recommended way to use Capybara is
24
- with [feature specs](../feature-specs/feature-spec).
25
-
26
- Scenario: specify managing a Widget with Rails integration methods
27
- Given a file named "spec/requests/widget_management_spec.rb" with:
28
- """ruby
29
- require "spec_helper"
30
-
31
- describe "Widget management" do
32
-
33
- it "creates a Widget and redirects to the Widget's page" do
34
- get "/widgets/new"
35
- expect(response).to render_template(:new)
36
-
37
- post "/widgets", :widget => {:name => "My Widget"}
38
-
39
- expect(response).to redirect_to(assigns(:widget))
40
- follow_redirect!
41
-
42
- expect(response).to render_template(:show)
43
- expect(response.body).to include("Widget was successfully created.")
44
- end
45
-
46
- end
47
- """
48
- When I run `rspec spec/requests/widget_management_spec.rb`
49
- Then the example should pass
@@ -1,16 +0,0 @@
1
- Routing specs live in the `spec/routing` directory, or any example group with
2
- `:type => :routing`.
3
-
4
- Simple apps with nothing but standard RESTful routes won't get much value from
5
- routing specs, but they can provide significant value when used to specify
6
- customized routes, like vanity links, slugs, etc.
7
-
8
- expect(:get => "/articles/2012/11/when-to-use-routing-specs").to route_to(
9
- :controller => "articles",
10
- :month => "2012-11",
11
- :slug => "when-to-use-routing-specs"
12
- )
13
-
14
- They are also valuable for routes that should not be available:
15
-
16
- expect(:delete => "/accounts/37").not_to be_routable
@@ -1,80 +0,0 @@
1
- Feature: be_routable matcher
2
-
3
- The `be_routable` matcher is best used with `should_not` to specify that a
4
- given route should not be routable. It is available in routing specs (in
5
- spec/routing) and controller specs (in spec/controllers).
6
-
7
- Scenario: specify routeable route should not be routable (fails)
8
- Given a file named "spec/routing/widgets_routing_spec.rb" with:
9
- """ruby
10
- require "spec_helper"
11
-
12
- describe "routes for Widgets" do
13
- it "does not route to widgets" do
14
- expect(:get => "/widgets").not_to be_routable
15
- end
16
- end
17
- """
18
-
19
- When I run `rspec spec/routing/widgets_routing_spec.rb`
20
- Then the output should contain "1 example, 1 failure"
21
-
22
- Scenario: specify non-routeable route should not be routable (passes)
23
- Given a file named "spec/routing/widgets_routing_spec.rb" with:
24
- """ruby
25
- require "spec_helper"
26
-
27
- describe "routes for Widgets" do
28
- it "does not route to widgets/foo/bar" do
29
- expect(:get => "/widgets/foo/bar").not_to be_routable
30
- end
31
- end
32
- """
33
-
34
- When I run `rspec spec/routing/widgets_routing_spec.rb`
35
- Then the examples should all pass
36
-
37
- Scenario: specify routeable route should be routable (passes)
38
- Given a file named "spec/routing/widgets_routing_spec.rb" with:
39
- """ruby
40
- require "spec_helper"
41
-
42
- describe "routes for Widgets" do
43
- it "routes to /widgets" do
44
- expect(:get => "/widgets").to be_routable
45
- end
46
- end
47
- """
48
-
49
- When I run `rspec spec/routing/widgets_routing_spec.rb`
50
- Then the examples should all pass
51
-
52
- Scenario: specify non-routeable route should be routable (fails)
53
- Given a file named "spec/routing/widgets_routing_spec.rb" with:
54
- """ruby
55
- require "spec_helper"
56
-
57
- describe "routes for Widgets" do
58
- it "routes to widgets/foo/bar" do
59
- expect(:get => "/widgets/foo/bar").to be_routable
60
- end
61
- end
62
- """
63
-
64
- When I run `rspec spec/routing/widgets_routing_spec.rb`
65
- Then the output should contain "1 example, 1 failure"
66
-
67
- Scenario: be_routable in a controller spec
68
- Given a file named "spec/controllers/widgets_controller_spec.rb" with:
69
- """ruby
70
- require "spec_helper"
71
-
72
- describe WidgetsController do
73
- it "routes to /widgets" do
74
- expect(:get => "/widgets").to be_routable
75
- end
76
- end
77
- """
78
-
79
- When I run `rspec spec/controllers/widgets_controller_spec.rb`
80
- Then the examples should all pass
@@ -1,38 +0,0 @@
1
- Feature: engine routes
2
-
3
- Routing specs can specify the routeset that will be used for the example
4
- group. This is most useful when testing Rails engines.
5
-
6
- @unsupported-on-rails-3-0
7
- Scenario: specify engine route
8
- Given a file named "spec/routing/engine_routes_spec.rb" with:
9
- """ruby
10
- require "spec_helper"
11
-
12
- # A very simple Rails engine
13
- module MyEngine
14
- class Engine < ::Rails::Engine
15
- isolate_namespace MyEngine
16
- end
17
-
18
- Engine.routes.draw do
19
- resources :widgets, :only => [:index]
20
- end
21
-
22
- class WidgetsController < ::ActionController::Base
23
- def index
24
- end
25
- end
26
- end
27
-
28
- describe MyEngine::WidgetsController do
29
- routes { MyEngine::Engine.routes }
30
-
31
- it "routes to the list of all widgets" do
32
- expect(:get => widgets_path).
33
- to route_to(:controller => "my_engine/widgets", :action => "index")
34
- end
35
- end
36
- """
37
- When I run `rspec spec`
38
- Then the examples should all pass
@@ -1,18 +0,0 @@
1
- Feature: named routes
2
-
3
- Routing specs have access to named routes.
4
-
5
- Scenario: access named route
6
- Given a file named "spec/routing/widget_routes_spec.rb" with:
7
- """ruby
8
- require "spec_helper"
9
-
10
- describe "routes to the widgets controller" do
11
- it "routes a named route" do
12
- expect(:get => new_widget_path).
13
- to route_to(:controller => "widgets", :action => "new")
14
- end
15
- end
16
- """
17
- When I run `rspec spec`
18
- Then the examples should all pass
@@ -1,90 +0,0 @@
1
- Feature: route_to matcher
2
-
3
- The `route_to` matcher specifies that a request (verb + path) is routable.
4
- It is most valuable when specifying routes other than standard RESTful
5
- routes.
6
-
7
- expect(get("/")).to route_to("welcome#index") # new in 2.6.0
8
-
9
- or
10
-
11
- expect(:get => "/").to route_to(:controller => "welcome")
12
-
13
- Scenario: passing route spec with shortcut syntax
14
- Given a file named "spec/routing/widgets_routing_spec.rb" with:
15
- """ruby
16
- require "spec_helper"
17
-
18
- describe "routes for Widgets" do
19
- it "routes /widgets to the widgets controller" do
20
- expect(get("/widgets")).
21
- to route_to("widgets#index")
22
- end
23
- end
24
- """
25
-
26
- When I run `rspec spec/routing/widgets_routing_spec.rb`
27
- Then the examples should all pass
28
-
29
- Scenario: passing route spec with verbose syntax
30
- Given a file named "spec/routing/widgets_routing_spec.rb" with:
31
- """ruby
32
- require "spec_helper"
33
-
34
- describe "routes for Widgets" do
35
- it "routes /widgets to the widgets controller" do
36
- expect(:get => "/widgets").
37
- to route_to(:controller => "widgets", :action => "index")
38
- end
39
- end
40
- """
41
-
42
- When I run `rspec spec/routing/widgets_routing_spec.rb`
43
- Then the examples should all pass
44
-
45
- Scenario: route spec for a route that doesn't exist (fails)
46
- Given a file named "spec/routing/widgets_routing_spec.rb" with:
47
- """ruby
48
- require "spec_helper"
49
-
50
- describe "routes for Widgets" do
51
- it "routes /widgets/foo to the /foo action" do
52
- expect(get("/widgets/foo")).to route_to("widgets#foo")
53
- end
54
- end
55
- """
56
-
57
- When I run `rspec spec/routing/widgets_routing_spec.rb`
58
- Then the output should contain "1 failure"
59
-
60
- Scenario: route spec for a namespaced route with shortcut specifier
61
- Given a file named "spec/routing/admin_routing_spec.rb" with:
62
- """ruby
63
- require "spec_helper"
64
-
65
- describe "routes for Widgets" do
66
- it "routes /admin/accounts to the admin/accounts controller" do
67
- expect(get("/admin/accounts")).
68
- to route_to("admin/accounts#index")
69
- end
70
- end
71
- """
72
-
73
- When I run `rspec spec/routing/admin_routing_spec.rb`
74
- Then the examples should all pass
75
-
76
- Scenario: route spec for a namespaced route with verbose specifier
77
- Given a file named "spec/routing/admin_routing_spec.rb" with:
78
- """ruby
79
- require "spec_helper"
80
-
81
- describe "routes for Widgets" do
82
- it "routes /admin/accounts to the admin/accounts controller" do
83
- expect(get("/admin/accounts")).
84
- to route_to(:controller => "admin/accounts", :action => "index")
85
- end
86
- end
87
- """
88
-
89
- When I run `rspec spec/routing/admin_routing_spec.rb`
90
- Then the examples should all pass
@@ -1,4 +0,0 @@
1
- Then /^the example(s)? should( all)? pass$/ do |_, _|
2
- step %q{the output should contain "0 failures"}
3
- step %q{the exit status should be 0}
4
- end
@@ -1,3 +0,0 @@
1
- Given /a (\w+) model/ do |model_class_name|
2
- puts eval(model_class_name)
3
- end
@@ -1,53 +0,0 @@
1
- require 'aruba/cucumber'
2
-
3
- module ArubaExt
4
- def run(cmd)
5
- super(cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd)
6
- end
7
- end
8
-
9
- World(ArubaExt)
10
-
11
- Before do
12
- @aruba_timeout_seconds = 30
13
- end
14
-
15
- unless File.directory?('./tmp/example_app')
16
- system "rake generate:app generate:stuff"
17
- end
18
-
19
- def aruba_path(file_or_dir)
20
- File.expand_path("../../../#{file_or_dir.sub('example_app','aruba')}", __FILE__)
21
- end
22
-
23
- def example_app_path(file_or_dir)
24
- File.expand_path("../../../#{file_or_dir}", __FILE__)
25
- end
26
-
27
- def write_symlink(file_or_dir)
28
- source = example_app_path(file_or_dir)
29
- target = aruba_path(file_or_dir)
30
- system "ln -s #{source} #{target}"
31
- end
32
-
33
- def copy(file_or_dir)
34
- source = example_app_path(file_or_dir)
35
- target = aruba_path(file_or_dir)
36
- system "cp -r #{source} #{target}"
37
- end
38
-
39
- Before do
40
- steps %Q{
41
- Given a directory named "spec"
42
- }
43
-
44
- Dir['tmp/example_app/*'].each do |file_or_dir|
45
- if !(file_or_dir =~ /spec$/)
46
- write_symlink(file_or_dir)
47
- end
48
- end
49
-
50
- ["spec/spec_helper.rb"].each do |file_or_dir|
51
- write_symlink("tmp/example_app/#{file_or_dir}")
52
- end
53
- end