formtastic 3.1.6 → 4.0.0.rc1

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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.gitignore +3 -2
  4. data/.travis.yml +28 -40
  5. data/CHANGELOG.md +49 -0
  6. data/DEPRECATIONS +1 -1
  7. data/Gemfile.lock +104 -0
  8. data/README.md +628 -629
  9. data/Rakefile +20 -1
  10. data/app/assets/stylesheets/formtastic.css +1 -1
  11. data/bin/appraisal +8 -0
  12. data/formtastic.gemspec +9 -14
  13. data/gemfiles/rails_5.2/Gemfile +5 -0
  14. data/gemfiles/rails_6.0/Gemfile +5 -0
  15. data/gemfiles/rails_edge/Gemfile +13 -0
  16. data/lib/formtastic/actions.rb +6 -3
  17. data/lib/formtastic/deprecation.rb +1 -38
  18. data/lib/formtastic/engine.rb +3 -1
  19. data/lib/formtastic/form_builder.rb +8 -24
  20. data/lib/formtastic/helpers/action_helper.rb +1 -48
  21. data/lib/formtastic/helpers/errors_helper.rb +2 -2
  22. data/lib/formtastic/helpers/fieldset_wrapper.rb +7 -3
  23. data/lib/formtastic/helpers/input_helper.rb +18 -76
  24. data/lib/formtastic/helpers/inputs_helper.rb +12 -3
  25. data/lib/formtastic/i18n.rb +1 -1
  26. data/lib/formtastic/inputs/base/collections.rb +1 -5
  27. data/lib/formtastic/inputs/base/errors.rb +4 -4
  28. data/lib/formtastic/inputs/base/hints.rb +1 -1
  29. data/lib/formtastic/inputs/base/timeish.rb +5 -1
  30. data/lib/formtastic/inputs/base/validations.rb +19 -9
  31. data/lib/formtastic/inputs/check_boxes_input.rb +3 -3
  32. data/lib/formtastic/inputs/color_input.rb +0 -1
  33. data/lib/formtastic/inputs/select_input.rb +1 -1
  34. data/lib/formtastic/inputs.rb +32 -29
  35. data/lib/formtastic/localizer.rb +4 -3
  36. data/lib/formtastic/version.rb +1 -1
  37. data/lib/formtastic.rb +5 -11
  38. data/lib/generators/templates/formtastic.rb +4 -6
  39. data/script/integration-template.rb +71 -0
  40. data/script/integration.sh +19 -0
  41. data/spec/action_class_finder_spec.rb +1 -1
  42. data/spec/actions/button_action_spec.rb +8 -8
  43. data/spec/actions/generic_action_spec.rb +60 -60
  44. data/spec/actions/input_action_spec.rb +7 -7
  45. data/spec/actions/link_action_spec.rb +10 -10
  46. data/spec/builder/custom_builder_spec.rb +36 -20
  47. data/spec/builder/error_proc_spec.rb +4 -4
  48. data/spec/builder/semantic_fields_for_spec.rb +27 -27
  49. data/spec/generators/formtastic/form/form_generator_spec.rb +25 -25
  50. data/spec/generators/formtastic/input/input_generator_spec.rb +31 -31
  51. data/spec/generators/formtastic/install/install_generator_spec.rb +9 -9
  52. data/spec/helpers/action_helper_spec.rb +328 -10
  53. data/spec/helpers/actions_helper_spec.rb +17 -17
  54. data/spec/helpers/form_helper_spec.rb +33 -33
  55. data/spec/helpers/input_helper_spec.rb +975 -2
  56. data/spec/helpers/inputs_helper_spec.rb +120 -105
  57. data/spec/helpers/reflection_helper_spec.rb +3 -3
  58. data/spec/helpers/semantic_errors_helper_spec.rb +22 -22
  59. data/spec/i18n_spec.rb +26 -26
  60. data/spec/input_class_finder_spec.rb +1 -1
  61. data/spec/inputs/base/collections_spec.rb +6 -6
  62. data/spec/inputs/base/validations_spec.rb +157 -19
  63. data/spec/inputs/boolean_input_spec.rb +55 -55
  64. data/spec/inputs/check_boxes_input_spec.rb +96 -95
  65. data/spec/inputs/color_input_spec.rb +51 -63
  66. data/spec/inputs/country_input_spec.rb +20 -20
  67. data/spec/inputs/custom_input_spec.rb +2 -6
  68. data/spec/inputs/datalist_input_spec.rb +1 -1
  69. data/spec/inputs/date_picker_input_spec.rb +42 -42
  70. data/spec/inputs/date_select_input_spec.rb +51 -37
  71. data/spec/inputs/datetime_picker_input_spec.rb +46 -46
  72. data/spec/inputs/datetime_select_input_spec.rb +53 -37
  73. data/spec/inputs/email_input_spec.rb +5 -5
  74. data/spec/inputs/file_input_spec.rb +6 -6
  75. data/spec/inputs/hidden_input_spec.rb +18 -18
  76. data/spec/inputs/include_blank_spec.rb +8 -8
  77. data/spec/inputs/label_spec.rb +20 -20
  78. data/spec/inputs/number_input_spec.rb +112 -112
  79. data/spec/inputs/password_input_spec.rb +5 -5
  80. data/spec/inputs/phone_input_spec.rb +5 -5
  81. data/spec/inputs/placeholder_spec.rb +5 -5
  82. data/spec/inputs/radio_input_spec.rb +63 -65
  83. data/spec/inputs/range_input_spec.rb +66 -66
  84. data/spec/inputs/readonly_spec.rb +4 -4
  85. data/spec/inputs/search_input_spec.rb +5 -5
  86. data/spec/inputs/select_input_spec.rb +92 -96
  87. data/spec/inputs/string_input_spec.rb +23 -23
  88. data/spec/inputs/text_input_spec.rb +16 -16
  89. data/spec/inputs/time_picker_input_spec.rb +43 -43
  90. data/spec/inputs/time_select_input_spec.rb +67 -54
  91. data/spec/inputs/time_zone_input_spec.rb +19 -19
  92. data/spec/inputs/url_input_spec.rb +5 -5
  93. data/spec/inputs/with_options_spec.rb +7 -7
  94. data/spec/localizer_spec.rb +17 -17
  95. data/spec/namespaced_class_finder_spec.rb +2 -2
  96. data/spec/schema.rb +21 -0
  97. data/spec/spec_helper.rb +163 -223
  98. data/spec/support/custom_macros.rb +72 -75
  99. data/spec/support/shared_examples.rb +0 -1301
  100. data/spec/support/test_environment.rb +23 -9
  101. metadata +36 -122
  102. data/Appraisals +0 -43
  103. data/CHANGELOG +0 -54
  104. data/gemfiles/rails_3.2.gemfile +0 -9
  105. data/gemfiles/rails_4.0.4.gemfile +0 -8
  106. data/gemfiles/rails_4.1.gemfile +0 -8
  107. data/gemfiles/rails_4.2.gemfile +0 -8
  108. data/gemfiles/rails_4.gemfile +0 -8
  109. data/gemfiles/rails_5.0.gemfile +0 -8
  110. data/gemfiles/rails_edge.gemfile +0 -15
  111. data/lib/formtastic/util.rb +0 -57
  112. data/spec/helpers/namespaced_action_helper_spec.rb +0 -43
  113. data/spec/helpers/namespaced_input_helper_spec.rb +0 -36
  114. data/spec/util_spec.rb +0 -66
@@ -1,44 +1,44 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
3
 
4
- describe 'Formtastic::FormBuilder#fields_for' do
4
+ RSpec.describe 'Formtastic::FormBuilder#fields_for' do
5
5
 
6
6
  include FormtasticSpecHelper
7
7
 
8
8
  before do
9
9
  @output_buffer = ''
10
10
  mock_everything
11
- @new_post.stub(:author).and_return(::Author.new)
11
+ allow(@new_post).to receive(:author).and_return(::Author.new)
12
12
  end
13
13
 
14
14
  context 'outside a form_for block' do
15
15
  it 'yields an instance of FormHelper.builder' do
16
16
  semantic_fields_for(@new_post) do |nested_builder|
17
- nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
17
+ expect(nested_builder.class).to eq(Formtastic::Helpers::FormHelper.builder)
18
18
  end
19
19
  semantic_fields_for(@new_post.author) do |nested_builder|
20
- nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
20
+ expect(nested_builder.class).to eq(Formtastic::Helpers::FormHelper.builder)
21
21
  end
22
22
  semantic_fields_for(:author, @new_post.author) do |nested_builder|
23
- nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
23
+ expect(nested_builder.class).to eq(Formtastic::Helpers::FormHelper.builder)
24
24
  end
25
25
  semantic_fields_for(:author, @hash_backed_author) do |nested_builder|
26
- nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
26
+ expect(nested_builder.class).to eq(Formtastic::Helpers::FormHelper.builder)
27
27
  end
28
28
  end
29
29
 
30
30
  it 'should respond to input' do
31
31
  semantic_fields_for(@new_post) do |nested_builder|
32
- nested_builder.respond_to?(:input).should be_truthy
32
+ expect(nested_builder.respond_to?(:input)).to be_truthy
33
33
  end
34
34
  semantic_fields_for(@new_post.author) do |nested_builder|
35
- nested_builder.respond_to?(:input).should be_truthy
35
+ expect(nested_builder.respond_to?(:input)).to be_truthy
36
36
  end
37
37
  semantic_fields_for(:author, @new_post.author) do |nested_builder|
38
- nested_builder.respond_to?(:input).should be_truthy
38
+ expect(nested_builder.respond_to?(:input)).to be_truthy
39
39
  end
40
40
  semantic_fields_for(:author, @hash_backed_author) do |nested_builder|
41
- nested_builder.respond_to?(:input).should be_truthy
41
+ expect(nested_builder.respond_to?(:input)).to be_truthy
42
42
  end
43
43
  end
44
44
  end
@@ -47,7 +47,7 @@ describe 'Formtastic::FormBuilder#fields_for' do
47
47
  it 'yields an instance of FormHelper.builder' do
48
48
  semantic_form_for(@new_post) do |builder|
49
49
  builder.semantic_fields_for(:author) do |nested_builder|
50
- nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
50
+ expect(nested_builder.class).to eq(Formtastic::Helpers::FormHelper.builder)
51
51
  end
52
52
  end
53
53
  end
@@ -55,7 +55,7 @@ describe 'Formtastic::FormBuilder#fields_for' do
55
55
  it 'yields an instance of FormHelper.builder with hash-like model' do
56
56
  semantic_form_for(:user) do |builder|
57
57
  builder.semantic_fields_for(:author, @hash_backed_author) do |nested_builder|
58
- nested_builder.class.should == Formtastic::Helpers::FormHelper.builder
58
+ expect(nested_builder.class).to eq(Formtastic::Helpers::FormHelper.builder)
59
59
  end
60
60
  end
61
61
  end
@@ -63,7 +63,7 @@ describe 'Formtastic::FormBuilder#fields_for' do
63
63
  it 'nests the object name' do
64
64
  semantic_form_for(@new_post) do |builder|
65
65
  builder.semantic_fields_for(@bob) do |nested_builder|
66
- nested_builder.object_name.should == 'post[author]'
66
+ expect(nested_builder.object_name).to eq('post[author]')
67
67
  end
68
68
  end
69
69
  end
@@ -71,45 +71,45 @@ describe 'Formtastic::FormBuilder#fields_for' do
71
71
  it 'supports passing collection as second parameter' do
72
72
  semantic_form_for(@new_post) do |builder|
73
73
  builder.semantic_fields_for(:author, [@fred,@bob]) do |nested_builder|
74
- nested_builder.object_name.should =~ /post\[author_attributes\]\[\d+\]/
74
+ expect(nested_builder.object_name).to match(/post\[author_attributes\]\[\d+\]/)
75
75
  end
76
76
  end
77
77
  end
78
78
 
79
79
  it 'should sanitize html id for li tag' do
80
- @bob.stub(:column_for_attribute).and_return(double('column', :type => :string, :limit => 255))
80
+ allow(@bob).to receive(:column_for_attribute).and_return(double('column', :type => :string, :limit => 255))
81
81
  concat(semantic_form_for(@new_post) do |builder|
82
82
  concat(builder.semantic_fields_for(@bob, :index => 1) do |nested_builder|
83
83
  concat(nested_builder.inputs(:login))
84
84
  end)
85
85
  end)
86
- output_buffer.should have_tag('form fieldset.inputs #post_author_1_login_input')
86
+ expect(output_buffer).to have_tag('form fieldset.inputs #post_author_1_login_input')
87
87
  # Not valid selector, so using good ol' regex
88
- output_buffer.should_not =~ /id="post\[author\]_1_login_input"/
88
+ expect(output_buffer).not_to match(/id="post\[author\]_1_login_input"/)
89
89
  # <=> output_buffer.should_not have_tag('form fieldset.inputs #post[author]_1_login_input')
90
90
  end
91
91
 
92
92
  it 'should use namespace provided in nested fields' do
93
- @bob.stub(:column_for_attribute).and_return(double('column', :type => :string, :limit => 255))
93
+ allow(@bob).to receive(:column_for_attribute).and_return(double('column', :type => :string, :limit => 255))
94
94
  concat(semantic_form_for(@new_post, :namespace => 'context2') do |builder|
95
95
  concat(builder.semantic_fields_for(@bob, :index => 1) do |nested_builder|
96
96
  concat(nested_builder.inputs(:login))
97
97
  end)
98
98
  end)
99
- output_buffer.should have_tag('form fieldset.inputs #context2_post_author_1_login_input')
99
+ expect(output_buffer).to have_tag('form fieldset.inputs #context2_post_author_1_login_input')
100
100
  end
101
101
 
102
102
  it 'should render errors on the nested inputs' do
103
103
  @errors = double('errors')
104
- @errors.stub(:[]).with(errors_matcher(:login)).and_return(['oh noes'])
105
- @bob.stub(:errors).and_return(@errors)
104
+ allow(@errors).to receive(:[]).with(errors_matcher(:login)).and_return(['oh noes'])
105
+ allow(@bob).to receive(:errors).and_return(@errors)
106
106
 
107
107
  concat(semantic_form_for(@new_post, :namespace => 'context2') do |builder|
108
108
  concat(builder.semantic_fields_for(@bob) do |nested_builder|
109
109
  concat(nested_builder.inputs(:login))
110
110
  end)
111
111
  end)
112
- output_buffer.should =~ /oh noes/
112
+ expect(output_buffer).to match(/oh noes/)
113
113
  end
114
114
 
115
115
  end
@@ -119,9 +119,9 @@ describe 'Formtastic::FormBuilder#fields_for' do
119
119
  before do
120
120
  output_buffer.replace ''
121
121
 
122
- @fred.posts.size.should == 1
123
- @fred.posts.first.stub(:persisted?).and_return(true)
124
- @fred.stub(:posts_attributes=)
122
+ expect(@fred.posts.size).to eq(1)
123
+ allow(@fred.posts.first).to receive(:persisted?).and_return(true)
124
+ allow(@fred).to receive(:posts_attributes=)
125
125
  concat(semantic_form_for(@fred) do |builder|
126
126
  concat(builder.semantic_fields_for(:posts) do |nested_builder|
127
127
  concat(nested_builder.input(:id, :as => :hidden))
@@ -131,11 +131,11 @@ describe 'Formtastic::FormBuilder#fields_for' do
131
131
  end
132
132
 
133
133
  it "should only render one hidden input (my one)" do
134
- output_buffer.should have_tag 'input#author_posts_attributes_0_id', :count => 1
134
+ expect(output_buffer).to have_tag 'input#author_posts_attributes_0_id', :count => 1
135
135
  end
136
136
 
137
137
  it "should render the hidden input inside an li.hidden" do
138
- output_buffer.should have_tag 'li.hidden input#author_posts_attributes_0_id'
138
+ expect(output_buffer).to have_tag 'li.hidden input#author_posts_attributes_0_id'
139
139
  end
140
140
  end
141
141
 
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  # Generators are not automatically loaded by Rails
4
4
  require 'generators/formtastic/form/form_generator'
5
5
 
6
- describe Formtastic::FormGenerator do
6
+ RSpec.describe Formtastic::FormGenerator do
7
7
 
8
8
  include FormtasticSpecHelper
9
9
 
@@ -14,7 +14,7 @@ describe Formtastic::FormGenerator do
14
14
  @output_buffer = ''
15
15
  prepare_destination
16
16
  mock_everything
17
- ::Post.stub(:reflect_on_all_associations).with(:belongs_to).and_return([
17
+ allow(::Post).to receive(:reflect_on_all_associations).with(:belongs_to).and_return([
18
18
  double('reflection', :name => :author, :options => {}, :klass => ::Author, :macro => :belongs_to),
19
19
  double('reflection', :name => :reviewer, :options => {:class_name => 'Author'}, :klass => ::Author, :macro => :belongs_to),
20
20
  double('reflection', :name => :main_post, :options => {}, :klass => ::Post, :macro => :belongs_to),
@@ -28,13 +28,13 @@ describe Formtastic::FormGenerator do
28
28
 
29
29
  describe 'without model' do
30
30
  it 'should raise Thor::RequiredArgumentMissingError' do
31
- lambda { run_generator }.should raise_error(Thor::RequiredArgumentMissingError)
31
+ expect { run_generator }.to raise_error(Thor::RequiredArgumentMissingError)
32
32
  end
33
33
  end
34
34
 
35
35
  describe 'with existing model' do
36
36
  it 'should not raise an exception' do
37
- lambda { run_generator %w(Post) }.should_not raise_error
37
+ expect { run_generator %w(Post) }.not_to raise_error
38
38
  end
39
39
  end
40
40
 
@@ -43,10 +43,10 @@ describe Formtastic::FormGenerator do
43
43
 
44
44
  describe 'render only the specified attributes' do
45
45
  subject { file('app/views/posts/_form.html.erb') }
46
- it { should exist }
47
- it { should contain "<%= f.input :title %>" }
48
- it { should contain "<%= f.input :author %>" }
49
- it { should_not contain "<%= f.input :main_post %>" }
46
+ it { is_expected.to exist }
47
+ it { is_expected.to contain "<%= f.input :title %>" }
48
+ it { is_expected.to contain "<%= f.input :author %>" }
49
+ it { is_expected.not_to contain "<%= f.input :main_post %>" }
50
50
  end
51
51
  end
52
52
 
@@ -56,17 +56,17 @@ describe Formtastic::FormGenerator do
56
56
  subject { file('app/views/posts/_form.html.erb') }
57
57
 
58
58
  describe 'content_columns' do
59
- it { should contain "<%= f.input :title %>" }
60
- it { should contain "<%= f.input :body %>" }
61
- it { should_not contain "<%= f.input :created_at %>" }
62
- it { should_not contain "<%= f.input :updated_at %>" }
59
+ it { is_expected.to contain "<%= f.input :title %>" }
60
+ it { is_expected.to contain "<%= f.input :body %>" }
61
+ it { is_expected.not_to contain "<%= f.input :created_at %>" }
62
+ it { is_expected.not_to contain "<%= f.input :updated_at %>" }
63
63
  end
64
64
 
65
65
  describe 'reflection_on_association' do
66
- it { should contain "<%= f.input :author %>" }
67
- it { should contain "<%= f.input :reviewer %>" }
68
- it { should contain "<%= f.input :main_post %>" }
69
- it { should_not contain "<%= f.input :attachment %>" }
66
+ it { is_expected.to contain "<%= f.input :author %>" }
67
+ it { is_expected.to contain "<%= f.input :reviewer %>" }
68
+ it { is_expected.to contain "<%= f.input :main_post %>" }
69
+ it { is_expected.not_to contain "<%= f.input :attachment %>" }
70
70
  end
71
71
  end
72
72
 
@@ -76,8 +76,8 @@ describe Formtastic::FormGenerator do
76
76
 
77
77
  describe 'app/views/posts/_form.html.erb' do
78
78
  subject { file('app/views/posts/_form.html.erb') }
79
- it { should exist }
80
- it { should contain "<%= semantic_form_for @post do |f| %>" }
79
+ it { is_expected.to exist }
80
+ it { is_expected.to contain "<%= semantic_form_for @post do |f| %>" }
81
81
  end
82
82
  end
83
83
 
@@ -86,15 +86,15 @@ describe Formtastic::FormGenerator do
86
86
  describe 'app/views/posts/_form.html.haml' do
87
87
  before { run_generator %w(Post --template-engine haml) }
88
88
  subject { file('app/views/posts/_form.html.haml') }
89
- it { should exist }
90
- it { should contain "= semantic_form_for @post do |f|" }
89
+ it { is_expected.to exist }
90
+ it { is_expected.to contain "= semantic_form_for @post do |f|" }
91
91
  end
92
92
 
93
93
  context 'with copy option' do
94
94
  describe 'app/views/posts/_form.html.haml' do
95
95
  before { run_generator %w(Post --copy --template-engine haml) }
96
96
  subject { file('app/views/posts/_form.html.haml') }
97
- it { should_not exist }
97
+ it { is_expected.not_to exist }
98
98
  end
99
99
  end
100
100
 
@@ -105,8 +105,8 @@ describe Formtastic::FormGenerator do
105
105
 
106
106
  describe 'app/views/posts/_form.html.slim' do
107
107
  subject { file('app/views/posts/_form.html.slim') }
108
- it { should exist }
109
- it { should contain "= semantic_form_for @post do |f|" }
108
+ it { is_expected.to exist }
109
+ it { is_expected.to contain "= semantic_form_for @post do |f|" }
110
110
  end
111
111
  end
112
112
  end
@@ -116,7 +116,7 @@ describe Formtastic::FormGenerator do
116
116
 
117
117
  describe 'app/views/posts/_form.html.erb' do
118
118
  subject { file('app/views/posts/_form.html.erb') }
119
- it { should_not exist }
119
+ it { is_expected.not_to exist }
120
120
  end
121
121
  end
122
122
 
@@ -125,7 +125,7 @@ describe Formtastic::FormGenerator do
125
125
 
126
126
  describe 'app/views/admin/posts/_form.html.erb' do
127
127
  subject { file('app/views/admin/posts/_form.html.erb') }
128
- it { should exist }
128
+ it { is_expected.to exist }
129
129
  end
130
130
  end
131
131
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  require 'generators/formtastic/input/input_generator'
4
4
 
5
- describe Formtastic::InputGenerator do
5
+ RSpec.describe Formtastic::InputGenerator do
6
6
  include FormtasticSpecHelper
7
7
 
8
8
  destination File.expand_path("../../../../../tmp", __FILE__)
@@ -17,7 +17,7 @@ describe Formtastic::InputGenerator do
17
17
 
18
18
  describe 'without file name' do
19
19
  it 'should raise Thor::RequiredArgumentMissingError' do
20
- lambda { run_generator }.should raise_error(Thor::RequiredArgumentMissingError)
20
+ expect { run_generator }.to raise_error(Thor::RequiredArgumentMissingError)
21
21
  end
22
22
  end
23
23
 
@@ -26,11 +26,11 @@ describe Formtastic::InputGenerator do
26
26
 
27
27
  describe 'generate an input in its respective folder' do
28
28
  subject{ file('app/inputs/hat_size_input.rb')}
29
- it { should exist}
30
- it { should contain "class HatSizeInput"}
31
- it { should contain "def to_html"}
32
- it { should contain "include Formtastic::Inputs::Base"}
33
- it { should_not contain "super"}
29
+ it { is_expected.to exist}
30
+ it { is_expected.to contain "class HatSizeInput"}
31
+ it { is_expected.to contain "def to_html"}
32
+ it { is_expected.to contain "include Formtastic::Inputs::Base"}
33
+ it { is_expected.not_to contain "super"}
34
34
  end
35
35
  end
36
36
 
@@ -39,8 +39,8 @@ describe Formtastic::InputGenerator do
39
39
 
40
40
  describe 'generate an input in its respective folder' do
41
41
  subject{ file('app/inputs/hat_size_input.rb')}
42
- it { should exist}
43
- it { should contain "class HatSizeInput"}
42
+ it { is_expected.to exist}
43
+ it { is_expected.to contain "class HatSizeInput"}
44
44
  end
45
45
  end
46
46
 
@@ -49,8 +49,8 @@ describe Formtastic::InputGenerator do
49
49
 
50
50
  describe 'generate an input in its respective folder' do
51
51
  subject{ file('app/inputs/hat_size_input.rb')}
52
- it { should exist}
53
- it { should contain "class HatSizeInput"}
52
+ it { is_expected.to exist}
53
+ it { is_expected.to contain "class HatSizeInput"}
54
54
  end
55
55
  end
56
56
 
@@ -59,8 +59,8 @@ describe Formtastic::InputGenerator do
59
59
 
60
60
  describe 'generate an input in its respective folder' do
61
61
  subject{ file('app/inputs/hat_size_input.rb')}
62
- it { should exist}
63
- it { should contain "class HatSizeInput"}
62
+ it { is_expected.to exist}
63
+ it { is_expected.to contain "class HatSizeInput"}
64
64
  end
65
65
  end
66
66
 
@@ -69,8 +69,8 @@ describe Formtastic::InputGenerator do
69
69
 
70
70
  describe 'generate an input in its respective folder' do
71
71
  subject{ file('app/inputs/hat_size_input.rb')}
72
- it { should exist}
73
- it { should contain "class HatSizeInput"}
72
+ it { is_expected.to exist}
73
+ it { is_expected.to contain "class HatSizeInput"}
74
74
  end
75
75
  end
76
76
 
@@ -79,12 +79,12 @@ describe Formtastic::InputGenerator do
79
79
 
80
80
  describe 'app/inputs/string_input.rb' do
81
81
  subject{ file('app/inputs/string_input.rb')}
82
- it { should exist }
83
- it { should contain "class StringInput < Formtastic::Inputs::StringInput" }
84
- it { should contain "def to_html" }
85
- it { should_not contain "include Formtastic::Inputs::Base" }
86
- it { should contain "super" }
87
- it { should_not contain "def input_html_options" }
82
+ it { is_expected.to exist }
83
+ it { is_expected.to contain "class StringInput < Formtastic::Inputs::StringInput" }
84
+ it { is_expected.to contain "def to_html" }
85
+ it { is_expected.not_to contain "include Formtastic::Inputs::Base" }
86
+ it { is_expected.to contain "super" }
87
+ it { is_expected.not_to contain "def input_html_options" }
88
88
  end
89
89
  end
90
90
 
@@ -93,10 +93,10 @@ describe Formtastic::InputGenerator do
93
93
 
94
94
  describe 'app/inputs/flexible_text_input.rb' do
95
95
  subject{ file('app/inputs/flexible_text_input.rb')}
96
- it { should contain "class FlexibleTextInput < Formtastic::Inputs::StringInput" }
97
- it { should contain "def input_html_options" }
98
- it { should_not contain "include Formtastic::Inputs::Base" }
99
- it { should_not contain "def to_html" }
96
+ it { is_expected.to contain "class FlexibleTextInput < Formtastic::Inputs::StringInput" }
97
+ it { is_expected.to contain "def input_html_options" }
98
+ it { is_expected.not_to contain "include Formtastic::Inputs::Base" }
99
+ it { is_expected.not_to contain "def to_html" }
100
100
  end
101
101
  end
102
102
 
@@ -105,9 +105,9 @@ describe Formtastic::InputGenerator do
105
105
 
106
106
  describe 'app/inputs/stuff/foo_input.rb' do
107
107
  subject{ file('app/inputs/stuff/foo_input.rb')}
108
- it {should exist}
109
- it { should contain "class Stuff::FooInput" }
110
- it { should contain "include Formtastic::Inputs::Base" }
108
+ it {is_expected.to exist}
109
+ it { is_expected.to contain "class Stuff::FooInput" }
110
+ it { is_expected.to contain "include Formtastic::Inputs::Base" }
111
111
  end
112
112
  end
113
113
 
@@ -116,9 +116,9 @@ describe Formtastic::InputGenerator do
116
116
 
117
117
  describe 'app/inputs/stuff/foo_input.rb' do
118
118
  subject{ file('app/inputs/stuff/foo_input.rb')}
119
- it {should exist}
120
- it { should contain "class Stuff::FooInput" }
121
- it { should contain "include Formtastic::Inputs::Base" }
119
+ it {is_expected.to exist}
120
+ it { is_expected.to contain "class Stuff::FooInput" }
121
+ it { is_expected.to contain "include Formtastic::Inputs::Base" }
122
122
  end
123
123
  end
124
124
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  # Generators are not automatically loaded by Rails
4
4
  require 'generators/formtastic/install/install_generator'
5
5
 
6
- describe Formtastic::InstallGenerator do
6
+ RSpec.describe Formtastic::InstallGenerator do
7
7
  # Tell the generator where to put its output (what it thinks of as Rails.root)
8
8
  destination File.expand_path("../../../../../tmp", __FILE__)
9
9
 
@@ -14,14 +14,14 @@ describe Formtastic::InstallGenerator do
14
14
 
15
15
  describe 'config/initializers/formtastic.rb' do
16
16
  subject { file('config/initializers/formtastic.rb') }
17
- it { should exist }
18
- it { should contain "#" }
17
+ it { is_expected.to exist }
18
+ it { is_expected.to contain "#" }
19
19
  end
20
20
 
21
21
  describe 'lib/templates/erb/scaffold/_form.html.erb' do
22
22
  subject { file('lib/templates/erb/scaffold/_form.html.erb') }
23
- it { should exist }
24
- it { should contain "<%%= semantic_form_for @<%= singular_name %> do |f| %>" }
23
+ it { is_expected.to exist }
24
+ it { is_expected.to contain "<%%= semantic_form_for @<%= singular_name %> do |f| %>" }
25
25
  end
26
26
  end
27
27
 
@@ -30,8 +30,8 @@ describe Formtastic::InstallGenerator do
30
30
 
31
31
  describe 'lib/templates/erb/scaffold/_form.html.haml' do
32
32
  subject { file('lib/templates/haml/scaffold/_form.html.haml') }
33
- it { should exist }
34
- it { should contain "= semantic_form_for @<%= singular_name %> do |f|" }
33
+ it { is_expected.to exist }
34
+ it { is_expected.to contain "= semantic_form_for @<%= singular_name %> do |f|" }
35
35
  end
36
36
  end
37
37
 
@@ -40,8 +40,8 @@ describe Formtastic::InstallGenerator do
40
40
 
41
41
  describe 'lib/templates/erb/scaffold/_form.html.slim' do
42
42
  subject { file('lib/templates/slim/scaffold/_form.html.slim') }
43
- it { should exist }
44
- it { should contain "= semantic_form_for @<%= singular_name %> do |f|" }
43
+ it { is_expected.to exist }
44
+ it { is_expected.to contain "= semantic_form_for @<%= singular_name %> do |f|" }
45
45
  end
46
46
  end
47
47
  end