dynamic_text 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -8
- data/app/assets/javascripts/dynamic_text/dynamic_text.js +7 -76
- data/app/assets/javascripts/dynamic_text/dynamic_text_preparer.js +62 -0
- data/app/assets/javascripts/dynamic_text/js.js +6 -0
- data/app/helpers/dynamic_text/view_helper.rb +6 -92
- data/app/views/dynamic_text/_dynamic_text.html.erb +4 -0
- data/app/views/dynamic_text/_editable_text.html.erb +20 -0
- data/lib/dynamic_text/configuration.rb +4 -4
- data/lib/dynamic_text/locals_setter.rb +70 -0
- data/lib/dynamic_text/version.rb +1 -1
- data/lib/dynamic_text/view_renderer.rb +39 -0
- data/lib/dynamic_text.rb +2 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +18 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +26 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +61 -0
- data/spec/dummy/config/environments/production.rb +94 -0
- data/spec/dummy/config/environments/test.rb +46 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/schema.rb +18 -0
- data/spec/dummy/log/development.log +38 -0
- data/spec/dummy/log/test.log +1646 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/view_helper_spec.rb +8 -0
- data/spec/integration/navigation_test.rb +7 -0
- data/spec/lib/locals_setter_spec.rb +114 -0
- data/spec/lib/view_renderer.rb +3 -0
- data/spec/rails_helper.rb +63 -0
- data/spec/spec_helper.rb +81 -0
- metadata +185 -4
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
.rails-default-error-page {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rails-default-error-page div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
.rails-default-error-page h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body class="rails-default-error-page">
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,8 @@
|
|
1
|
+
RSpec.describe DynamicText::ViewHelper, type: :helper do
|
2
|
+
describe '#dynamic_text' do
|
3
|
+
it 'returns a span with class dynamic_text' do
|
4
|
+
# content_tag(:span, text, class: "dynamic-text", data: {"dynamic-tag": tag})
|
5
|
+
# expect(helper.dynamic_text).to have_class("dynamic-text")
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
RSpec.describe DynamicText::LocalsSetter do
|
2
|
+
|
3
|
+
class Resource
|
4
|
+
attr_reader :attribute, :id
|
5
|
+
|
6
|
+
def initialize(attribute)
|
7
|
+
@id = id
|
8
|
+
@attribute = attribute
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:id) do
|
13
|
+
102
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:attribute_value) do
|
17
|
+
'value_of_attribute'
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:resource) do
|
21
|
+
Resource.new(attribute_value)
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#get_dynamic_locals' do
|
25
|
+
it 'returns a hash with :resource set to the first parameter' do
|
26
|
+
output = subject.get_dynamic_locals(resource, :attribute)
|
27
|
+
expect(output[:resource]).to eq(resource)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns a hash with :attribute set to the second parameter' do
|
31
|
+
output = subject.get_dynamic_locals(resource, :attribute)
|
32
|
+
expect(output[:attribute]).to eq(:attribute)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns a hash with :value set to the result of :attribute being called on :resource' do
|
36
|
+
output = subject.get_dynamic_locals(resource, :attribute)
|
37
|
+
expect(output[:value]).to eq(resource.attribute).and eq(attribute_value)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns a hash with :placeholder defaulted to "Enter #{attribute}..."' do
|
41
|
+
output = subject.get_dynamic_locals(resource, :attribute)
|
42
|
+
expect(output[:placeholder]).to eq("Enter attribute...")
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'returns a hash with :placeholder set to value of the :placeholder keyword argument' do
|
46
|
+
placeholder = "I am a placeholder"
|
47
|
+
output = subject.get_dynamic_locals(resource, :attribute, placeholder: placeholder)
|
48
|
+
expect(output[:placeholder]).to eq(placeholder)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'returns a hash with :resource_type set to the resource class name without capitals' do
|
52
|
+
output = subject.get_dynamic_locals(resource, :attribute)
|
53
|
+
expect(output[:resource_type]).to eq('resource')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'returns a hash with :dynamic_tag defaulted to format resource_type:resource_id:attribute"' do
|
57
|
+
output = subject.get_dynamic_locals(resource, :attribute)
|
58
|
+
expect(output[:dynamic_tag]).to eq("resource:#{resource.id}:attribute")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#get_editable_locals' do
|
63
|
+
it 'returns a hash with :resource set to the first parameter' do
|
64
|
+
output = subject.get_editable_locals(resource, :attribute)
|
65
|
+
expect(output[:resource]).to eq(resource)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'returns a hash with :attribute set to the second parameter' do
|
69
|
+
output = subject.get_editable_locals(resource, :attribute)
|
70
|
+
expect(output[:attribute]).to eq(:attribute)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'returns a hash with :value set to the result of :attribute being called on :resource' do
|
74
|
+
output = subject.get_editable_locals(resource, :attribute)
|
75
|
+
expect(output[:value]).to eq(resource.attribute).and eq(attribute_value)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'returns a hash with :placeholder defaulted to "Enter #{attribute}..."' do
|
79
|
+
output = subject.get_editable_locals(resource, :attribute)
|
80
|
+
expect(output[:placeholder]).to eq("Enter attribute...")
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'returns a hash with :placeholder set to value of the :placeholder keyword argument' do
|
84
|
+
placeholder = "I am a placeholder"
|
85
|
+
output = subject.get_editable_locals(resource, :attribute, placeholder: placeholder)
|
86
|
+
expect(output[:placeholder]).to eq(placeholder)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'returns a hash with :resource_type set to the resource class name without capitals' do
|
90
|
+
output = subject.get_editable_locals(resource, :attribute)
|
91
|
+
expect(output[:resource_type]).to eq('resource')
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'returns a hash with :dynamic_tag defaulted to format resource_type:resource_id:attribute"' do
|
95
|
+
output = subject.get_editable_locals(resource, :attribute)
|
96
|
+
expect(output[:dynamic_tag]).to eq("resource:#{resource.id}:attribute")
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'returns a hash with :dynamic_tag defaulted to format resource_type:resource_id:attribute"' do
|
100
|
+
output = subject.get_editable_locals(resource, :attribute)
|
101
|
+
expect(output[:dynamic_tag]).to eq("resource:#{resource.id}:attribute")
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'returns a hash with :url set to convential rails path for resource' do
|
105
|
+
output = subject.get_editable_locals(resource, :attribute)
|
106
|
+
expect(output[:url]).to eq("/resources/#{resource.id}")
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'returns a hash with :js_key defaulted to format resource_type:attribute' do
|
110
|
+
output = subject.get_editable_locals(resource, :attribute)
|
111
|
+
expect(output[:js_key]).to eq("resource:attribute")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'pry'
|
4
|
+
ENV['RAILS_ENV'] ||= 'test'
|
5
|
+
require File.expand_path('../dummy/config/environment', __FILE__)
|
6
|
+
# Prevent database truncation if the environment is production
|
7
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
8
|
+
require 'rspec/rails'
|
9
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
10
|
+
|
11
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
12
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
13
|
+
# run as spec files by default. This means that files in spec/support that end
|
14
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
15
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
16
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
17
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
18
|
+
#
|
19
|
+
# The following line is provided for convenience purposes. It has the downside
|
20
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
21
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
22
|
+
# require only the support files necessary.
|
23
|
+
#
|
24
|
+
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
25
|
+
|
26
|
+
# Checks for pending migrations and applies them before tests are run.
|
27
|
+
# If you are not using ActiveRecord, you can remove these lines.
|
28
|
+
begin
|
29
|
+
ActiveRecord::Migration.maintain_test_schema!
|
30
|
+
rescue ActiveRecord::PendingMigrationError => e
|
31
|
+
puts e.to_s.strip
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec.configure do |config|
|
36
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
37
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
38
|
+
|
39
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
40
|
+
# examples within a transaction, remove the following line or assign false
|
41
|
+
# instead of true.
|
42
|
+
config.use_transactional_fixtures = true
|
43
|
+
|
44
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
45
|
+
# based on their file location, for example enabling you to call `get` and
|
46
|
+
# `post` in specs under `spec/controllers`.
|
47
|
+
#
|
48
|
+
# You can disable this behaviour by removing the line below, and instead
|
49
|
+
# explicitly tag your specs with their type, e.g.:
|
50
|
+
#
|
51
|
+
# RSpec.describe UsersController, :type => :controller do
|
52
|
+
# # ...
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# The different available types are documented in the features, such as in
|
56
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
57
|
+
config.infer_spec_type_from_file_location!
|
58
|
+
|
59
|
+
# Filter lines from Rails gems in backtraces.
|
60
|
+
config.filter_rails_from_backtrace!
|
61
|
+
# arbitrary gems may also be filtered via:
|
62
|
+
# config.filter_gems_from_backtrace("gem name")
|
63
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
# rspec-expectations config goes here. You can use an alternate
|
3
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
4
|
+
# assertions if you prefer.
|
5
|
+
config.expect_with :rspec do |expectations|
|
6
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
7
|
+
# and `failure_message` of custom matchers include text for helper methods
|
8
|
+
# defined using `chain`, e.g.:
|
9
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
10
|
+
# # => "be bigger than 2 and smaller than 4"
|
11
|
+
# ...rather than:
|
12
|
+
# # => "be bigger than 2"
|
13
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
14
|
+
end
|
15
|
+
|
16
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
17
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
18
|
+
config.mock_with :rspec do |mocks|
|
19
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
20
|
+
# a real object. This is generally recommended, and will default to
|
21
|
+
# `true` in RSpec 4.
|
22
|
+
mocks.verify_partial_doubles = true
|
23
|
+
end
|
24
|
+
|
25
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
26
|
+
# have no way to turn it off -- the option exists only for backwards
|
27
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
28
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
29
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
30
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
31
|
+
|
32
|
+
# The settings below are suggested to provide a good initial experience
|
33
|
+
# with RSpec, but feel free to customize to your heart's content.
|
34
|
+
=begin
|
35
|
+
# This allows you to limit a spec run to individual examples or groups
|
36
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
37
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
38
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
39
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
40
|
+
config.filter_run_when_matching :focus
|
41
|
+
|
42
|
+
# Allows RSpec to persist some state between runs in order to support
|
43
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
44
|
+
# you configure your source control system to ignore this file.
|
45
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
46
|
+
|
47
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
48
|
+
# recommended. For more details, see:
|
49
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
50
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
51
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
52
|
+
config.disable_monkey_patching!
|
53
|
+
|
54
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
55
|
+
# file, and it's useful to allow more verbose output when running an
|
56
|
+
# individual spec file.
|
57
|
+
if config.files_to_run.one?
|
58
|
+
# Use the documentation formatter for detailed output,
|
59
|
+
# unless a formatter has already been configured
|
60
|
+
# (e.g. via a command-line flag).
|
61
|
+
config.default_formatter = "doc"
|
62
|
+
end
|
63
|
+
|
64
|
+
# Print the 10 slowest examples and example groups at the
|
65
|
+
# end of the spec run, to help surface which specs are running
|
66
|
+
# particularly slow.
|
67
|
+
config.profile_examples = 10
|
68
|
+
|
69
|
+
# Run specs in random order to surface order dependencies. If you find an
|
70
|
+
# order dependency and want to debug it, you can fix the order by providing
|
71
|
+
# the seed, which is printed after each run.
|
72
|
+
# --seed 1234
|
73
|
+
config.order = :random
|
74
|
+
|
75
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
76
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
77
|
+
# test failures related to randomization by passing the same `--seed` value
|
78
|
+
# as the one that triggered the failure.
|
79
|
+
Kernel.srand config.seed
|
80
|
+
=end
|
81
|
+
end
|