rspec-rails 3.0.0.beta2 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -1
- data/Capybara.md +1 -3
- data/Changelog.md +126 -58
- data/README.md +31 -4
- data/lib/generators/rspec/controller/templates/controller_spec.rb +1 -1
- data/lib/generators/rspec/controller/templates/view_spec.rb +1 -1
- data/lib/generators/rspec/feature/templates/feature_spec.rb +1 -1
- data/lib/generators/rspec/helper/templates/helper_spec.rb +1 -1
- data/lib/generators/rspec/install/templates/spec/spec_helper.rb.tt +21 -1
- data/lib/generators/rspec/integration/templates/request_spec.rb +1 -1
- data/lib/generators/rspec/mailer/templates/mailer_spec.rb +1 -1
- data/lib/generators/rspec/model/templates/model_spec.rb +1 -1
- data/lib/generators/rspec/observer/templates/observer_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +11 -3
- data/lib/generators/rspec/scaffold/templates/edit_spec.rb +4 -3
- data/lib/generators/rspec/scaffold/templates/index_spec.rb +2 -2
- data/lib/generators/rspec/scaffold/templates/new_spec.rb +5 -4
- data/lib/generators/rspec/scaffold/templates/routing_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/show_spec.rb +2 -2
- data/lib/generators/rspec/view/templates/view_spec.rb +1 -1
- data/lib/rspec/rails.rb +1 -8
- data/lib/rspec/rails/configuration.rb +72 -0
- data/lib/rspec/rails/example.rb +0 -64
- data/lib/rspec/rails/example/controller_example_group.rb +16 -12
- data/lib/rspec/rails/example/feature_example_group.rb +0 -2
- data/lib/rspec/rails/example/helper_example_group.rb +0 -2
- data/lib/rspec/rails/example/mailer_example_group.rb +0 -1
- data/lib/rspec/rails/example/model_example_group.rb +0 -4
- data/lib/rspec/rails/example/request_example_group.rb +0 -2
- data/lib/rspec/rails/example/routing_example_group.rb +0 -2
- data/lib/rspec/rails/example/view_example_group.rb +1 -2
- data/lib/rspec/rails/extensions.rb +0 -1
- data/lib/rspec/rails/fixture_support.rb +0 -8
- data/lib/rspec/rails/matchers.rb +1 -0
- data/lib/rspec/rails/matchers/have_http_status.rb +355 -0
- data/lib/rspec/rails/matchers/routing_matchers.rb +1 -1
- data/lib/rspec/rails/tasks/rspec.rake +12 -5
- data/lib/rspec/rails/version.rb +1 -1
- data/lib/rspec/rails/view_rendering.rb +6 -34
- metadata +42 -316
- metadata.gz.sig +0 -0
- data/features/Generators.md +0 -25
- data/features/GettingStarted.md +0 -84
- data/features/README.md +0 -48
- data/features/RailsVersions.md +0 -4
- data/features/Transactions.md +0 -84
- data/features/Upgrade.md +0 -121
- data/features/controller_specs/Cookies.md +0 -57
- data/features/controller_specs/README.md +0 -45
- data/features/controller_specs/anonymous_controller.feature +0 -436
- data/features/controller_specs/bypass_rescue.feature +0 -75
- data/features/controller_specs/controller_spec.feature +0 -58
- data/features/controller_specs/engine_routes.feature +0 -51
- data/features/controller_specs/isolation_from_views.feature +0 -87
- data/features/controller_specs/render_views.feature +0 -114
- data/features/directory_structure.feature +0 -71
- data/features/feature_specs/feature_spec.feature +0 -35
- data/features/helper_specs/helper_spec.feature +0 -122
- data/features/mailer_specs/url_helpers.feature +0 -38
- data/features/matchers/README.md +0 -18
- data/features/matchers/new_record_matcher.feature +0 -41
- data/features/matchers/redirect_to_matcher.feature +0 -40
- data/features/matchers/relation_match_array.feature +0 -27
- data/features/matchers/render_template_matcher.feature +0 -49
- data/features/mocks/mock_model.feature +0 -147
- data/features/mocks/stub_model.feature +0 -58
- data/features/model_specs/README.md +0 -21
- data/features/model_specs/errors_on.feature +0 -51
- data/features/model_specs/records.feature +0 -27
- data/features/model_specs/transactional_examples.feature +0 -109
- data/features/request_specs/request_spec.feature +0 -49
- data/features/routing_specs/README.md +0 -16
- data/features/routing_specs/be_routable_matcher.feature +0 -80
- data/features/routing_specs/engine_routes.feature +0 -38
- data/features/routing_specs/named_routes.feature +0 -18
- data/features/routing_specs/route_to_matcher.feature +0 -90
- data/features/step_definitions/additional_cli_steps.rb +0 -4
- data/features/step_definitions/model_steps.rb +0 -3
- data/features/support/capybara.rb +0 -7
- data/features/support/env.rb +0 -53
- data/features/support/rails_versions.rb +0 -4
- data/features/support/rubinius.rb +0 -6
- data/features/view_specs/inferred_controller_path.feature +0 -45
- data/features/view_specs/stub_template.feature +0 -51
- data/features/view_specs/view_spec.feature +0 -206
- data/lib/rspec/rails/extensions/active_record/base.rb +0 -58
- data/lib/rspec/rails/mocks.rb +0 -272
- data/lib/rspec/rails/vendor/webrat.rb +0 -33
- data/spec/generators/rspec/controller/controller_generator_spec.rb +0 -97
- data/spec/generators/rspec/feature/feature_generator_spec.rb +0 -43
- data/spec/generators/rspec/helper/helper_generator_spec.rb +0 -30
- data/spec/generators/rspec/install/install_generator_spec.rb +0 -30
- data/spec/generators/rspec/integration/integration_generator_spec.rb +0 -32
- data/spec/generators/rspec/mailer/mailer_generator_spec.rb +0 -48
- data/spec/generators/rspec/model/model_generator_spec.rb +0 -52
- data/spec/generators/rspec/observer/observer_generator_spec.rb +0 -21
- data/spec/generators/rspec/scaffold/scaffold_generator_spec.rb +0 -138
- data/spec/generators/rspec/view/view_generator_spec.rb +0 -41
- data/spec/rspec/rails/assertion_adapter_spec.rb +0 -28
- data/spec/rspec/rails/assertion_delegator_spec.rb +0 -43
- data/spec/rspec/rails/configuration_spec.rb +0 -26
- data/spec/rspec/rails/deprecations_spec.rb +0 -18
- data/spec/rspec/rails/example/controller_example_group_spec.rb +0 -159
- data/spec/rspec/rails/example/feature_example_group_spec.rb +0 -56
- data/spec/rspec/rails/example/helper_example_group_spec.rb +0 -66
- data/spec/rspec/rails/example/mailer_example_group_spec.rb +0 -21
- data/spec/rspec/rails/example/model_example_group_spec.rb +0 -15
- data/spec/rspec/rails/example/request_example_group_spec.rb +0 -17
- data/spec/rspec/rails/example/routing_example_group_spec.rb +0 -32
- data/spec/rspec/rails/example/view_example_group_spec.rb +0 -235
- data/spec/rspec/rails/extensions/active_model/errors_on_spec.rb +0 -23
- data/spec/rspec/rails/extensions/active_record/base_spec.rb +0 -42
- data/spec/rspec/rails/fixture_support_spec.rb +0 -17
- data/spec/rspec/rails/matchers/be_a_new_spec.rb +0 -142
- data/spec/rspec/rails/matchers/be_new_record_spec.rb +0 -33
- data/spec/rspec/rails/matchers/be_routable_spec.rb +0 -41
- data/spec/rspec/rails/matchers/be_valid_spec.rb +0 -73
- data/spec/rspec/rails/matchers/has_spec.rb +0 -29
- data/spec/rspec/rails/matchers/have_rendered_spec.rb +0 -93
- data/spec/rspec/rails/matchers/redirect_to_spec.rb +0 -81
- data/spec/rspec/rails/matchers/relation_match_array_spec.rb +0 -31
- data/spec/rspec/rails/matchers/route_to_spec.rb +0 -151
- data/spec/rspec/rails/minitest_lifecycle_adapter_spec.rb +0 -31
- data/spec/rspec/rails/mocks/mock_model_spec.rb +0 -400
- data/spec/rspec/rails/mocks/stub_model_spec.rb +0 -154
- data/spec/rspec/rails/setup_and_teardown_adapter_spec.rb +0 -32
- data/spec/rspec/rails/view_rendering_spec.rb +0 -111
- data/spec/spec_helper.rb +0 -33
- data/spec/support/ar_classes.rb +0 -42
- data/spec/support/helpers.rb +0 -34
- data/spec/support/matchers.rb +0 -9
- data/spec/support/null_object.rb +0 -6
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/rspec/helper/helper_generator'
|
5
|
-
|
6
|
-
describe Rspec::Generators::HelperGenerator do
|
7
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
|
-
|
10
|
-
before { prepare_destination }
|
11
|
-
|
12
|
-
subject { file('spec/helpers/posts_helper_spec.rb') }
|
13
|
-
describe 'generated by default' do
|
14
|
-
before do
|
15
|
-
run_generator %w(posts)
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'the spec' do
|
19
|
-
it { is_expected.to exist }
|
20
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
21
|
-
it { is_expected.to contain(/describe PostsHelper/) }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
describe 'skipped with a flag' do
|
25
|
-
before do
|
26
|
-
run_generator %w(posts --no-helper_specs)
|
27
|
-
end
|
28
|
-
it { is_expected.not_to exist }
|
29
|
-
end
|
30
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'generators/rspec/install/install_generator'
|
3
|
-
|
4
|
-
describe Rspec::Generators::InstallGenerator do
|
5
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
6
|
-
|
7
|
-
before { prepare_destination }
|
8
|
-
|
9
|
-
it "generates .rspec" do
|
10
|
-
run_generator
|
11
|
-
expect(file('.rspec')).to exist
|
12
|
-
end
|
13
|
-
|
14
|
-
it "generates spec/spec_helper.rb" do
|
15
|
-
run_generator
|
16
|
-
expect(File.read( file('spec/spec_helper.rb') )).to match(/^require 'rspec\/rails'$/m)
|
17
|
-
end
|
18
|
-
|
19
|
-
if ::Rails::VERSION::STRING >= '4'
|
20
|
-
it "generates spec/spec_helper.rb with a check for pending migrations" do
|
21
|
-
run_generator
|
22
|
-
expect(File.read( file('spec/spec_helper.rb') )).to match(/ActiveRecord::Migration\.check_pending!/m)
|
23
|
-
end
|
24
|
-
else
|
25
|
-
it "generates spec/spec_helper.rb without a check for pending migrations" do
|
26
|
-
run_generator
|
27
|
-
expect(File.read( file('spec/spec_helper.rb') )).not_to match(/ActiveRecord::Migration\.check_pending!/m)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/rspec/integration/integration_generator'
|
5
|
-
|
6
|
-
describe Rspec::Generators::IntegrationGenerator do
|
7
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
|
-
|
10
|
-
before { prepare_destination }
|
11
|
-
|
12
|
-
describe 'are not generated' do
|
13
|
-
before do
|
14
|
-
run_generator %w(posts --no-request-specs)
|
15
|
-
end
|
16
|
-
describe 'index.html.erb' do
|
17
|
-
subject { file('spec/requests/posts_spec.rb') }
|
18
|
-
it { is_expected.not_to exist }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'are generated' do
|
23
|
-
before do
|
24
|
-
run_generator %w(posts)
|
25
|
-
end
|
26
|
-
subject { file('spec/requests/posts_spec.rb') }
|
27
|
-
it { is_expected.to exist }
|
28
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
29
|
-
it { is_expected.to contain(/describe "GET \/posts"/) }
|
30
|
-
it { is_expected.to contain(/get posts_index_path/) }
|
31
|
-
end
|
32
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/rspec/mailer/mailer_generator'
|
5
|
-
|
6
|
-
describe Rspec::Generators::MailerGenerator do
|
7
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
|
-
|
10
|
-
before { prepare_destination }
|
11
|
-
|
12
|
-
describe 'mailer spec' do
|
13
|
-
subject { file('spec/mailers/posts_spec.rb') }
|
14
|
-
describe 'a spec is created for each action' do
|
15
|
-
before do
|
16
|
-
run_generator %w(posts index show)
|
17
|
-
end
|
18
|
-
it { is_expected.to exist }
|
19
|
-
it { is_expected.to contain(/require "spec_helper"/) }
|
20
|
-
it { is_expected.to contain(/describe "index" do/) }
|
21
|
-
it { is_expected.to contain(/describe "show" do/) }
|
22
|
-
end
|
23
|
-
describe 'creates placeholder when no actions specified' do
|
24
|
-
before do
|
25
|
-
run_generator %w(posts)
|
26
|
-
end
|
27
|
-
it { is_expected.to exist }
|
28
|
-
it { is_expected.to contain(/require "spec_helper"/) }
|
29
|
-
it { is_expected.to contain(/pending "add some examples to \(or delete\)/) }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'a fixture is generated for each action' do
|
34
|
-
before do
|
35
|
-
run_generator %w(posts index show)
|
36
|
-
end
|
37
|
-
describe 'index' do
|
38
|
-
subject { file('spec/fixtures/posts/index') }
|
39
|
-
it { is_expected.to exist }
|
40
|
-
it { is_expected.to contain(/Posts#index/) }
|
41
|
-
end
|
42
|
-
describe 'show' do
|
43
|
-
subject { file('spec/fixtures/posts/show') }
|
44
|
-
it { is_expected.to exist }
|
45
|
-
it { is_expected.to contain(/Posts#show/) }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/rspec/model/model_generator'
|
5
|
-
|
6
|
-
describe Rspec::Generators::ModelGenerator do
|
7
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
|
-
|
10
|
-
before { prepare_destination }
|
11
|
-
|
12
|
-
it 'runs both the model and fixture tasks' do
|
13
|
-
gen = generator %w(posts)
|
14
|
-
expect(gen).to receive :create_model_spec
|
15
|
-
expect(gen).to receive :create_fixture_file
|
16
|
-
capture(:stdout) { gen.invoke_all }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'the generated files' do
|
20
|
-
describe 'with fixtures' do
|
21
|
-
before do
|
22
|
-
run_generator %w(posts --fixture)
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'the spec' do
|
26
|
-
subject { file('spec/models/posts_spec.rb') }
|
27
|
-
|
28
|
-
it { is_expected.to exist }
|
29
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
30
|
-
it { is_expected.to contain(/describe Posts/) }
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'the fixtures' do
|
34
|
-
subject { file('spec/fixtures/posts.yml') }
|
35
|
-
|
36
|
-
it { is_expected.to contain(Regexp.new('# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html')) }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe 'without fixtures' do
|
41
|
-
before do
|
42
|
-
run_generator %w(posts)
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'the fixtures' do
|
46
|
-
subject { file('spec/fixtures/posts.yml') }
|
47
|
-
|
48
|
-
it { is_expected.not_to exist }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/rspec/observer/observer_generator'
|
5
|
-
|
6
|
-
describe Rspec::Generators::ObserverGenerator do
|
7
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
|
-
|
10
|
-
subject { file('spec/models/posts_observer_spec.rb') }
|
11
|
-
before do
|
12
|
-
prepare_destination
|
13
|
-
run_generator %w(posts)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'the spec' do
|
17
|
-
it { is_expected.to exist }
|
18
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
19
|
-
it { is_expected.to contain(/describe PostsObserver/) }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,138 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require 'generators/rspec/scaffold/scaffold_generator'
|
4
|
-
|
5
|
-
describe Rspec::Generators::ScaffoldGenerator do
|
6
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
7
|
-
|
8
|
-
before { prepare_destination }
|
9
|
-
|
10
|
-
describe 'standard controller spec' do
|
11
|
-
subject { file('spec/controllers/posts_controller_spec.rb') }
|
12
|
-
|
13
|
-
describe 'with no options' do
|
14
|
-
before { run_generator %w(posts) }
|
15
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
16
|
-
it { is_expected.to contain(/describe PostsController/) }
|
17
|
-
it { is_expected.to contain(%({ "these" => "params" })) }
|
18
|
-
end
|
19
|
-
|
20
|
-
describe 'with --no-controller_specs' do
|
21
|
-
before { run_generator %w(posts --no-controller_specs) }
|
22
|
-
it { is_expected.not_to exist }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'controller spec with attributes specified' do
|
27
|
-
subject { file('spec/controllers/posts_controller_spec.rb') }
|
28
|
-
before { run_generator %w(posts title:string) }
|
29
|
-
|
30
|
-
it { is_expected.to contain(%({ "title" => "MyString" })) }
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'namespaced controller spec' do
|
34
|
-
subject { file('spec/controllers/admin/posts_controller_spec.rb') }
|
35
|
-
before { run_generator %w(admin/posts) }
|
36
|
-
it { is_expected.to contain(/describe Admin::PostsController/)}
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'view specs' do
|
40
|
-
describe 'with no options' do
|
41
|
-
before { run_generator %w(posts) }
|
42
|
-
describe 'edit' do
|
43
|
-
subject { file("spec/views/posts/edit.html.erb_spec.rb") }
|
44
|
-
it { is_expected.to exist }
|
45
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
46
|
-
it { is_expected.to contain(/describe "(.*)\/edit"/) }
|
47
|
-
it { is_expected.to contain(/it "renders the edit (.*) form"/) }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'index' do
|
51
|
-
subject { file("spec/views/posts/index.html.erb_spec.rb") }
|
52
|
-
it { is_expected.to exist }
|
53
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
54
|
-
it { is_expected.to contain(/describe "(.*)\/index"/) }
|
55
|
-
it { is_expected.to contain(/it "renders a list of (.*)"/) }
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'new' do
|
59
|
-
subject { file("spec/views/posts/new.html.erb_spec.rb") }
|
60
|
-
it { is_expected.to exist }
|
61
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
62
|
-
it { is_expected.to contain(/describe "(.*)\/new"/) }
|
63
|
-
it { is_expected.to contain(/it "renders new (.*) form"/) }
|
64
|
-
end
|
65
|
-
|
66
|
-
describe 'show' do
|
67
|
-
subject { file("spec/views/posts/show.html.erb_spec.rb") }
|
68
|
-
it { is_expected.to exist }
|
69
|
-
it { is_expected.to contain(/require 'spec_helper'/) }
|
70
|
-
it { is_expected.to contain(/describe "(.*)\/show"/) }
|
71
|
-
it { is_expected.to contain(/it "renders attributes in <p>"/) }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe 'with --no-template-engine' do
|
76
|
-
before { run_generator %w(posts --no-template-engine) }
|
77
|
-
describe 'edit' do
|
78
|
-
subject { file("spec/views/posts/edit.html._spec.rb") }
|
79
|
-
it { is_expected.not_to exist }
|
80
|
-
end
|
81
|
-
|
82
|
-
describe 'index' do
|
83
|
-
subject { file("spec/views/posts/index.html._spec.rb") }
|
84
|
-
it { is_expected.not_to exist }
|
85
|
-
end
|
86
|
-
|
87
|
-
describe 'new' do
|
88
|
-
subject { file("spec/views/posts/new.html._spec.rb") }
|
89
|
-
it { is_expected.not_to exist }
|
90
|
-
end
|
91
|
-
|
92
|
-
describe 'show' do
|
93
|
-
subject { file("spec/views/posts/show.html._spec.rb") }
|
94
|
-
it { is_expected.not_to exist }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe 'with --no-view-specs' do
|
99
|
-
before { run_generator %w(posts --no-view-specs) }
|
100
|
-
|
101
|
-
describe 'edit' do
|
102
|
-
subject { file("spec/views/posts/edit.html.erb_spec.rb") }
|
103
|
-
it { is_expected.not_to exist }
|
104
|
-
end
|
105
|
-
|
106
|
-
describe 'index' do
|
107
|
-
subject { file("spec/views/posts/index.html.erb_spec.rb") }
|
108
|
-
it { is_expected.not_to exist }
|
109
|
-
end
|
110
|
-
|
111
|
-
describe 'new' do
|
112
|
-
subject { file("spec/views/posts/new.html.erb_spec.rb") }
|
113
|
-
it { is_expected.not_to exist }
|
114
|
-
end
|
115
|
-
|
116
|
-
describe 'show' do
|
117
|
-
subject { file("spec/views/posts/show.html.erb_spec.rb") }
|
118
|
-
it { is_expected.not_to exist }
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe 'routing spec' do
|
124
|
-
subject { file('spec/routing/posts_routing_spec.rb') }
|
125
|
-
|
126
|
-
describe 'with default options' do
|
127
|
-
before { run_generator %w(posts) }
|
128
|
-
it { is_expected.to contain(/require "spec_helper"/) }
|
129
|
-
it { is_expected.to contain(/describe PostsController/) }
|
130
|
-
it { is_expected.to contain(/describe "routing"/) }
|
131
|
-
end
|
132
|
-
|
133
|
-
describe 'with --no-routing-specs' do
|
134
|
-
before { run_generator %w(posts --no-routing_specs) }
|
135
|
-
it { is_expected.not_to exist }
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Generators are not automatically loaded by Rails
|
4
|
-
require 'generators/rspec/view/view_generator'
|
5
|
-
|
6
|
-
describe Rspec::Generators::ViewGenerator do
|
7
|
-
# Tell the generator where to put its output (what it thinks of as Rails.root)
|
8
|
-
destination File.expand_path("../../../../../tmp", __FILE__)
|
9
|
-
|
10
|
-
before { prepare_destination }
|
11
|
-
|
12
|
-
describe 'with default template engine' do
|
13
|
-
it 'generates a spec for the supplied action' do
|
14
|
-
run_generator %w(posts index)
|
15
|
-
file('spec/views/posts/index.html.erb_spec.rb').tap do |f|
|
16
|
-
expect(f).to contain(/require 'spec_helper'/)
|
17
|
-
expect(f).to contain(/describe "posts\/index"/)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'with a nested resource' do
|
22
|
-
it 'generates a spec for the supplied action' do
|
23
|
-
run_generator %w(admin/posts index)
|
24
|
-
file('spec/views/admin/posts/index.html.erb_spec.rb').tap do |f|
|
25
|
-
expect(f).to contain(/require 'spec_helper'/)
|
26
|
-
expect(f).to contain(/describe "admin\/posts\/index"/)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'with a specified template engine' do
|
33
|
-
it 'generates a spec for the supplied action' do
|
34
|
-
run_generator %w(posts index --template_engine haml)
|
35
|
-
file('spec/views/posts/index.html.haml_spec.rb').tap do |f|
|
36
|
-
expect(f).to contain(/require 'spec_helper'/)
|
37
|
-
expect(f).to contain(/describe "posts\/index"/)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe RSpec::Rails::MinitestAssertionAdapter do
|
4
|
-
include RSpec::Rails::MinitestAssertionAdapter
|
5
|
-
|
6
|
-
RSpec::Rails::Assertions.public_instance_methods.select{|m| m.to_s =~ /^(assert|flunk|refute)/}.each do |m|
|
7
|
-
if m.to_s == "assert_equal"
|
8
|
-
it "exposes #{m} to host examples" do
|
9
|
-
assert_equal 3,3
|
10
|
-
expect do
|
11
|
-
assert_equal 3,4
|
12
|
-
end.to raise_error(ActiveSupport::TestCase::Assertion)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
it "exposes #{m} to host examples" do
|
16
|
-
expect(methods).to include(m)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it "does not expose internal methods of Minitest" do
|
22
|
-
expect(methods).not_to include("_assertions")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "does not expose Minitest's message method" do
|
26
|
-
expect(methods).not_to include("message")
|
27
|
-
end
|
28
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe RSpec::Rails::AssertionDelegator do
|
4
|
-
it "provides a module that delegates assertion methods to an isolated class" do
|
5
|
-
klass = Class.new {
|
6
|
-
include RSpec::Rails::AssertionDelegator.new(RSpec::Rails::Assertions)
|
7
|
-
}
|
8
|
-
|
9
|
-
expect(klass.new).to respond_to(:assert)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "delegates back to the including instance for methods the assertion module requires" do
|
13
|
-
assertions = Module.new {
|
14
|
-
def has_thing?(thing)
|
15
|
-
self.things.include?(thing)
|
16
|
-
end
|
17
|
-
}
|
18
|
-
|
19
|
-
klass = Class.new {
|
20
|
-
include RSpec::Rails::AssertionDelegator.new(assertions)
|
21
|
-
|
22
|
-
def things
|
23
|
-
[:a]
|
24
|
-
end
|
25
|
-
}
|
26
|
-
|
27
|
-
expect(klass.new).to have_thing(:a)
|
28
|
-
expect(klass.new).not_to have_thing(:b)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "does not delegate method_missing" do
|
32
|
-
assertions = Module.new {
|
33
|
-
def method_missing(method, *args)
|
34
|
-
end
|
35
|
-
}
|
36
|
-
|
37
|
-
klass = Class.new {
|
38
|
-
include RSpec::Rails::AssertionDelegator.new(assertions)
|
39
|
-
}
|
40
|
-
|
41
|
-
expect { klass.new.abc123 }.to raise_error(NoMethodError)
|
42
|
-
end
|
43
|
-
end
|