paper_trail_manager 0.6.0 → 0.7.0

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 (156) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +88 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +33 -0
  5. data/Appraisals +23 -12
  6. data/CHANGES.md +6 -0
  7. data/Gemfile +2 -1
  8. data/Rakefile +17 -5
  9. data/app/controllers/paper_trail_manager/changes_controller.rb +103 -100
  10. data/app/helpers/paper_trail_manager/changes_helper.rb +15 -11
  11. data/app/views/paper_trail_manager/changes/index.atom.builder +23 -19
  12. data/gemfiles/rails_4.2.2_paper_trail_3.0_kaminari.gemfile +9 -5
  13. data/gemfiles/rails_4.2.2_paper_trail_3.0_will_paginate.gemfile +9 -5
  14. data/gemfiles/rails_4.2.2_paper_trail_4.0_kaminari.gemfile +9 -5
  15. data/gemfiles/rails_4.2.2_paper_trail_4.0_will_paginate.gemfile +9 -5
  16. data/gemfiles/rails_4.2.2_paper_trail_5.0_kaminari.gemfile +13 -0
  17. data/gemfiles/rails_4.2.2_paper_trail_5.0_will_paginate.gemfile +13 -0
  18. data/gemfiles/rails_4.2.2_paper_trail_6.0_kaminari.gemfile +13 -0
  19. data/gemfiles/rails_4.2.2_paper_trail_6.0_will_paginate.gemfile +13 -0
  20. data/gemfiles/rails_4.2.2_paper_trail_7.0_kaminari.gemfile +13 -0
  21. data/gemfiles/rails_4.2.2_paper_trail_7.0_will_paginate.gemfile +13 -0
  22. data/gemfiles/rails_4.2.2_paper_trail_8.0_kaminari.gemfile +13 -0
  23. data/gemfiles/rails_4.2.2_paper_trail_8.0_will_paginate.gemfile +13 -0
  24. data/gemfiles/rails_5.0.0_paper_trail_5.0_kaminari.gemfile +13 -0
  25. data/gemfiles/rails_5.0.0_paper_trail_5.0_will_paginate.gemfile +13 -0
  26. data/gemfiles/rails_5.0.0_paper_trail_6.0_kaminari.gemfile +13 -0
  27. data/gemfiles/rails_5.0.0_paper_trail_6.0_will_paginate.gemfile +13 -0
  28. data/gemfiles/rails_5.0.0_paper_trail_7.0_kaminari.gemfile +13 -0
  29. data/gemfiles/rails_5.0.0_paper_trail_7.0_will_paginate.gemfile +13 -0
  30. data/gemfiles/rails_5.0.0_paper_trail_8.0_kaminari.gemfile +13 -0
  31. data/gemfiles/rails_5.0.0_paper_trail_8.0_will_paginate.gemfile +13 -0
  32. data/gemfiles/rails_5.1.0_paper_trail_10.0_kaminari.gemfile +13 -0
  33. data/gemfiles/rails_5.1.0_paper_trail_10.0_will_paginate.gemfile +13 -0
  34. data/gemfiles/rails_5.1.0_paper_trail_7.0_kaminari.gemfile +13 -0
  35. data/gemfiles/rails_5.1.0_paper_trail_7.0_will_paginate.gemfile +13 -0
  36. data/gemfiles/rails_5.1.0_paper_trail_8.0_kaminari.gemfile +13 -0
  37. data/gemfiles/rails_5.1.0_paper_trail_8.0_will_paginate.gemfile +13 -0
  38. data/gemfiles/rails_5.1.0_paper_trail_9.0_kaminari.gemfile +13 -0
  39. data/gemfiles/rails_5.1.0_paper_trail_9.0_will_paginate.gemfile +13 -0
  40. data/gemfiles/rails_5.2.0_paper_trail_10.0_kaminari.gemfile +13 -0
  41. data/gemfiles/rails_5.2.0_paper_trail_10.0_will_paginate.gemfile +13 -0
  42. data/gemfiles/rails_5.2.0_paper_trail_9.0_kaminari.gemfile +13 -0
  43. data/gemfiles/rails_5.2.0_paper_trail_9.0_will_paginate.gemfile +13 -0
  44. data/gemfiles/rails_6.0.0_paper_trail_10.0_kaminari.gemfile +14 -0
  45. data/gemfiles/rails_6.0.0_paper_trail_10.0_will_paginate.gemfile +15 -0
  46. data/lib/paper_trail_manager.rb +10 -10
  47. data/paper_trail_manager.gemspec +22 -21
  48. data/spec/app_template.rb +30 -0
  49. data/spec/integration/navigation_spec.rb +4 -2
  50. data/spec/integration/paper_trail_manager_spec.rb +94 -110
  51. data/spec/rails_helper.rb +6 -4
  52. data/spec/spec_helper.rb +7 -5
  53. data/spec/support/factories.rb +2 -1
  54. data/spec/support/rspec_html_matchers.rb +7 -0
  55. metadata +78 -229
  56. data/.travis.yml +0 -23
  57. data/gemfiles/rails_3.2.0_paper_trail_3.0_kaminari.gemfile +0 -10
  58. data/gemfiles/rails_3.2.0_paper_trail_3.0_will_paginate.gemfile +0 -10
  59. data/gemfiles/rails_3.2.0_paper_trail_4.0_kaminari.gemfile +0 -10
  60. data/gemfiles/rails_3.2.0_paper_trail_4.0_will_paginate.gemfile +0 -10
  61. data/gemfiles/rails_4.0.0_paper_trail_3.0_kaminari.gemfile +0 -9
  62. data/gemfiles/rails_4.0.0_paper_trail_3.0_will_paginate.gemfile +0 -9
  63. data/gemfiles/rails_4.0.0_paper_trail_4.0_kaminari.gemfile +0 -9
  64. data/gemfiles/rails_4.0.0_paper_trail_4.0_will_paginate.gemfile +0 -9
  65. data/gemfiles/rails_4.1.0_paper_trail_3.0_kaminari.gemfile +0 -9
  66. data/gemfiles/rails_4.1.0_paper_trail_3.0_will_paginate.gemfile +0 -9
  67. data/gemfiles/rails_4.1.0_paper_trail_4.0_kaminari.gemfile +0 -9
  68. data/gemfiles/rails_4.1.0_paper_trail_4.0_will_paginate.gemfile +0 -9
  69. data/spec/controllers/entities_controller_spec.rb +0 -125
  70. data/spec/controllers/platforms_controller_spec.rb +0 -125
  71. data/spec/dummy/.gitignore +0 -15
  72. data/spec/dummy/Gemfile +0 -9
  73. data/spec/dummy/README.rdoc +0 -261
  74. data/spec/dummy/Rakefile +0 -7
  75. data/spec/dummy/app/assets/images/rails.png +0 -0
  76. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  77. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  78. data/spec/dummy/app/controllers/application_controller.rb +0 -6
  79. data/spec/dummy/app/controllers/entities_controller.rb +0 -83
  80. data/spec/dummy/app/controllers/platforms_controller.rb +0 -83
  81. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  82. data/spec/dummy/app/helpers/entities_helper.rb +0 -2
  83. data/spec/dummy/app/helpers/platforms_helper.rb +0 -2
  84. data/spec/dummy/app/mailers/.gitkeep +0 -0
  85. data/spec/dummy/app/models/.gitkeep +0 -0
  86. data/spec/dummy/app/models/entity.rb +0 -6
  87. data/spec/dummy/app/models/platform.rb +0 -6
  88. data/spec/dummy/app/views/application/index.html.erb +0 -6
  89. data/spec/dummy/app/views/entities/_form.html.erb +0 -17
  90. data/spec/dummy/app/views/entities/edit.html.erb +0 -6
  91. data/spec/dummy/app/views/entities/index.html.erb +0 -21
  92. data/spec/dummy/app/views/entities/new.html.erb +0 -5
  93. data/spec/dummy/app/views/entities/show.html.erb +0 -5
  94. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  95. data/spec/dummy/app/views/platforms/_form.html.erb +0 -17
  96. data/spec/dummy/app/views/platforms/edit.html.erb +0 -6
  97. data/spec/dummy/app/views/platforms/index.html.erb +0 -21
  98. data/spec/dummy/app/views/platforms/new.html.erb +0 -5
  99. data/spec/dummy/app/views/platforms/show.html.erb +0 -5
  100. data/spec/dummy/config/application.rb +0 -64
  101. data/spec/dummy/config/boot.rb +0 -6
  102. data/spec/dummy/config/database.yml +0 -22
  103. data/spec/dummy/config/environment.rb +0 -5
  104. data/spec/dummy/config/environments/development.rb +0 -37
  105. data/spec/dummy/config/environments/production.rb +0 -67
  106. data/spec/dummy/config/environments/test.rb +0 -36
  107. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  108. data/spec/dummy/config/initializers/inflections.rb +0 -15
  109. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  110. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  111. data/spec/dummy/config/initializers/session_store.rb +0 -8
  112. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  113. data/spec/dummy/config/locales/en.yml +0 -5
  114. data/spec/dummy/config/routes.rb +0 -8
  115. data/spec/dummy/config.ru +0 -4
  116. data/spec/dummy/db/migrate/20110228091428_create_entities.rb +0 -14
  117. data/spec/dummy/db/migrate/20110228093241_create_platforms.rb +0 -14
  118. data/spec/dummy/db/migrate/20110228094444_create_versions.rb +0 -18
  119. data/spec/dummy/db/schema.rb +0 -41
  120. data/spec/dummy/db/seeds.rb +0 -7
  121. data/spec/dummy/doc/README_FOR_APP +0 -2
  122. data/spec/dummy/lib/assets/.gitkeep +0 -0
  123. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  124. data/spec/dummy/log/.gitkeep +0 -0
  125. data/spec/dummy/public/404.html +0 -26
  126. data/spec/dummy/public/422.html +0 -26
  127. data/spec/dummy/public/500.html +0 -25
  128. data/spec/dummy/public/favicon.ico +0 -0
  129. data/spec/dummy/public/index.html +0 -241
  130. data/spec/dummy/public/robots.txt +0 -5
  131. data/spec/dummy/script/rails +0 -6
  132. data/spec/dummy/test/fixtures/.gitkeep +0 -0
  133. data/spec/dummy/test/functional/.gitkeep +0 -0
  134. data/spec/dummy/test/integration/.gitkeep +0 -0
  135. data/spec/dummy/test/performance/browsing_test.rb +0 -12
  136. data/spec/dummy/test/test_helper.rb +0 -13
  137. data/spec/dummy/test/unit/.gitkeep +0 -0
  138. data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
  139. data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  140. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  141. data/spec/helpers/entities_helper_spec.rb +0 -15
  142. data/spec/helpers/platforms_helper_spec.rb +0 -15
  143. data/spec/models/entity_spec.rb +0 -14
  144. data/spec/models/platform_spec.rb +0 -14
  145. data/spec/requests/entities_spec.rb +0 -11
  146. data/spec/requests/platforms_spec.rb +0 -11
  147. data/spec/routing/entities_routing_spec.rb +0 -35
  148. data/spec/routing/platforms_routing_spec.rb +0 -35
  149. data/spec/views/entities/edit.html.erb_spec.rb +0 -15
  150. data/spec/views/entities/index.html.erb_spec.rb +0 -14
  151. data/spec/views/entities/new.html.erb_spec.rb +0 -15
  152. data/spec/views/entities/show.html.erb_spec.rb +0 -11
  153. data/spec/views/platforms/edit.html.erb_spec.rb +0 -15
  154. data/spec/views/platforms/index.html.erb_spec.rb +0 -14
  155. data/spec/views/platforms/new.html.erb_spec.rb +0 -15
  156. data/spec/views/platforms/show.html.erb_spec.rb +0 -11
@@ -1,72 +1,55 @@
1
- require 'spec_helper'
2
-
3
- describe PaperTrailManager, :versioning => true do
4
- def version
5
- return assigns[:version]
6
- end
7
-
8
- def versions
9
- return assigns[:versions]
10
- end
11
-
12
- def item_types
13
- return versions.map(&:item_type).uniq.sort
14
- end
15
-
16
- def populate
17
- @reimu = FactoryGirl.create(:entity, :name => "Miko Hakurei Reimu", :status => "Highly Responsive to Prayers")
18
- @reimu.update_attributes(:name => "Hakurei Reimu", :status => "Phantasmagoria of Dimensional Dream")
19
- @reimu.update_attributes(:status => "Perfect Cherry Blossom")
1
+ # frozen_string_literal: true
20
2
 
21
- @sakuya = FactoryGirl.create(:entity, :name => "Sakuya Izayoi", :status => "Flowering Night")
22
-
23
- @flanchan = FactoryGirl.create(:entity, :name => "Flandre Scarlet", :status => "The Embodiment of Scarlet Devil")
24
- @flanchan.destroy
25
-
26
- @kyuu_hachi = FactoryGirl.create(:platform, :name => "PC-9801", :status => "SUGOI!!1!")
27
- @kyuu_hachi.update_attributes(:status => "Kimochi warui.")
28
- @kyuu_hachi.destroy
29
-
30
- @uinodouzu = FactoryGirl.create(:platform, :name => "Mikorusofto Uinodouzu", :status => 'o-O')
31
- end
3
+ require 'spec_helper'
32
4
 
33
- context "without changes" do
34
- context "index" do
35
- it "should have no changes by default" do
36
- get "/changes"
5
+ describe PaperTrailManager, versioning: true do
6
+ context 'without changes' do
7
+ context 'when fetching the index' do
8
+ it 'has no changes by default' do
9
+ get '/changes'
37
10
 
38
- assigns[:versions].should be_empty
11
+ expect(response.body).to include('No changes found')
39
12
  end
40
13
  end
41
14
  end
42
15
 
43
- context "with changes" do
44
- before do
45
- populate
46
- end
16
+ context 'with changes' do
17
+ let(:reimu) { FactoryGirl.create(:entity, name: 'Miko Hakurei Reimu', status: 'Highly Responsive to Prayers') }
18
+ let(:flanchan) { FactoryGirl.create(:entity, name: 'Flandre Scarlet', status: 'The Embodiment of Scarlet Devil') }
19
+ let(:sakuya) { FactoryGirl.create(:entity, name: 'Sakuya Izayoi', status: 'Flowering Night') }
20
+ let(:kyuu_hachi) { FactoryGirl.create(:platform, name: 'PC-9801', status: 'SUGOI!!1!') }
21
+ let!(:uinodouzu) { FactoryGirl.create(:platform, name: 'Mikorusofto Uinodouzu', status: 'o-O') }
22
+
23
+ let!(:flanchan_id) { flanchan.id }
47
24
 
48
- after do
49
- Entity.destroy_all
50
- Platform.destroy_all
51
- PaperTrail::Version.destroy_all
25
+ before do
26
+ sakuya
27
+ reimu.update(name: 'Hakurei Reimu', status: 'Phantasmagoria of Dimensional Dream')
28
+ reimu.update(status: 'Perfect Cherry Blossom')
29
+ flanchan.destroy
30
+ kyuu_hachi.update(status: 'Kimochi warui.')
31
+ kyuu_hachi.destroy
32
+ uinodouzu
52
33
  end
53
34
 
54
- context "index" do
55
- context "when getting all changes" do
56
- context "and authorized" do
57
- context "and getting default index" do
35
+ describe 'index' do
36
+ context 'when getting all changes' do
37
+ context 'with authorization' do
38
+ context 'when getting default index' do
58
39
  before { get changes_path }
59
40
 
60
- it "should have all changes" do
61
- versions.size.should == 10
41
+ it 'has all changes' do
42
+ expect(response.body).to have_tag('.change_row', count: 10)
62
43
  end
63
44
 
64
- it "should have changes for all changed item types" do
65
- item_types.should == ["Entity", "Platform"]
45
+ it 'has changes for all changed item types' do
46
+ expect(response.body).to have_tag('.change_item', text: /Entity/)
47
+ expect(response.body).to have_tag('.change_item', text: /Platform/)
66
48
  end
67
49
 
68
- it "should order changes with newest and highest id at the top" do
69
- versions.map(&:id).should == versions.sort_by { |o| [o.created_at, o.id] }.reverse.map(&:id)
50
+ it 'orders changes with newest and highest id at the top' do
51
+ ids = response.body.scan(/Change #(\d+)/).flatten.map(&:to_i)
52
+ expect(ids).to eq ids.sort.reverse
70
53
  end
71
54
  end
72
55
  end
@@ -77,16 +60,17 @@ describe PaperTrailManager, :versioning => true do
77
60
  # end
78
61
  end
79
62
 
80
- context "when getting changes for a specific type" do
81
- context "that exists" do
82
- before { get changes_path(:type => "Entity") }
63
+ context 'when getting changes for a specific type' do
64
+ context 'when changes exist' do
65
+ before { get changes_path(type: 'Entity') }
83
66
 
84
- it "should show a subset of the changes" do
85
- versions.size.should == 6
67
+ it 'shows a subset of the changes' do
68
+ expect(response.body).to have_tag('.change_row', count: 6)
86
69
  end
87
70
 
88
- it "should have changes only for that type" do
89
- item_types.should == ["Entity"]
71
+ it 'has changes only for that type' do
72
+ expect(response.body).to have_tag('.change_item', text: /Entity/)
73
+ expect(response.body).not_to have_tag('.change_item', text: /Platform/)
90
74
  end
91
75
  end
92
76
 
@@ -96,20 +80,21 @@ describe PaperTrailManager, :versioning => true do
96
80
  # end
97
81
  end
98
82
 
99
- context "when getting changes for a specific record" do
100
- context "that exists" do
101
- before { get changes_path(:type => "Entity", :id => @reimu.id) }
83
+ context 'when getting changes for a specific record' do
84
+ context 'when changes exist' do
85
+ before { get changes_path(type: 'Entity', id: reimu.id) }
102
86
 
103
- it "should show a subset of the changes" do
104
- versions.size.should == 3
87
+ it 'shows a subset of the changes' do
88
+ expect(response.body).to have_tag('.change_row', count: 3)
105
89
  end
106
90
 
107
- it "should have changes only for that type" do
108
- item_types.should == ["Entity"]
91
+ it 'has changes only for that type' do
92
+ expect(response.body).to have_tag('.change_item', text: /Entity/)
93
+ expect(response.body).not_to have_tag('.change_item', text: /Platform/)
109
94
  end
110
95
 
111
- it "should have changes only for that record" do
112
- versions.map(&:item_id).uniq.should == [@reimu.id]
96
+ it 'has changes only for that record' do
97
+ expect(response.body.scan(%r{/entities/(#{reimu.id})}).flatten.uniq).to eq [reimu.id.to_s]
113
98
  end
114
99
  end
115
100
 
@@ -120,24 +105,25 @@ describe PaperTrailManager, :versioning => true do
120
105
  end
121
106
  end
122
107
 
123
- context "show a change" do
124
- context "that exists" do
125
- context "when authorized" do
108
+ describe 'showing a change' do
109
+ context 'when the change exists' do
110
+ context 'when authorized' do
111
+ let(:version) { reimu.versions.last }
112
+
126
113
  before do
127
- @version = @reimu.versions.last
128
- get change_path(@version)
114
+ get change_path(version)
129
115
  end
130
116
 
131
- it "should show the requested change" do
132
- version.should == @version
117
+ it 'shows the requested change' do
118
+ expect(response.body).to have_tag('.change_id', text: "Change ##{version.id}")
133
119
  end
134
120
 
135
- it "should show a change with the right event" do
136
- version.event.should == "update"
121
+ it 'shows a change with the right event' do
122
+ expect(response.body).to have_tag('.change_event_update')
137
123
  end
138
124
 
139
- it "should be associated with the expected record" do
140
- version.item.should == @reimu
125
+ it 'is associated with the expected record' do
126
+ expect(response.body).to have_tag('.change_item', text: "Entity #{reimu.id}")
141
127
  end
142
128
  end
143
129
 
@@ -152,50 +138,48 @@ describe PaperTrailManager, :versioning => true do
152
138
  # it "should display an error that the change doesn't exist"
153
139
  # end
154
140
  end
155
- end
156
-
157
- context "when rolling back changes" do
158
- context "that that exist" do
159
- before(:each) { populate }
160
141
 
161
- context "when authorized" do
162
- it "should rollback a newly-created record by deleting it" do
163
- Entity.exists?(@reimu.id).should be_truthy
142
+ describe 'rolling back changes' do
143
+ context 'when changes exist' do
144
+ context 'when authorized' do
145
+ it 'rollbacks a newly-created record by deleting it' do
146
+ expect(Entity).to exist(reimu.id)
164
147
 
165
- put change_path(@reimu.versions.first)
148
+ put change_path(reimu.versions.first)
166
149
 
167
- Entity.exists?(@reimu.id).should be_falsey
168
- end
150
+ expect(Entity).not_to exist(reimu.id)
151
+ end
169
152
 
170
- it "should rollback an edit by reverting to the previous state" do
171
- @reimu.reload
172
- @reimu.status.should == "Perfect Cherry Blossom"
153
+ it 'rollbacks an edit by reverting to the previous state' do
154
+ reimu.reload
155
+ expect(reimu.status).to eq 'Perfect Cherry Blossom'
173
156
 
174
- put change_path(@reimu.versions.last)
157
+ put change_path(reimu.versions.last)
175
158
 
176
- @reimu.reload
177
- @reimu.status.should == "Phantasmagoria of Dimensional Dream"
178
- end
159
+ reimu.reload
160
+ expect(reimu.status).to eq 'Phantasmagoria of Dimensional Dream'
161
+ end
179
162
 
180
- it "should rollback a delete by restoring the record" do
181
- Entity.exists?(@flanchan.id).should be_falsey
163
+ it 'rollbacks a delete by restoring the record' do
164
+ Entity.exists?(flanchan_id).should be_falsey
182
165
 
183
- put change_path(PaperTrail::Version.where(:item_id => @flanchan.id, :item_type => "Entity").last)
166
+ put change_path(PaperTrail::Version.where(item_id: flanchan_id, item_type: 'Entity').last)
184
167
 
185
- flanchan = Entity.find(@flanchan.id)
186
- flanchan.status.should == "The Embodiment of Scarlet Devil"
168
+ found = Entity.find(flanchan_id)
169
+ expect(found.status).to eq 'The Embodiment of Scarlet Devil'
170
+ end
187
171
  end
172
+
173
+ # TODO
174
+ # context "when not authorized" do
175
+ # it "should display an error if user is not allowed to revert that change"
176
+ # end
188
177
  end
189
178
 
190
179
  # TODO
191
- # context "when not authorized" do
192
- # it "should display an error if user is not allowed to revert that change"
180
+ # context "that don't exist" do
181
+ # it "should display an error that the change doesn't exist"
193
182
  # end
194
183
  end
195
-
196
- # TODO
197
- # context "that don't exist" do
198
- # it "should display an error that the change doesn't exist"
199
- # end
200
184
  end
201
185
  end
data/spec/rails_helper.rb CHANGED
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
- ENV["RAILS_ENV"] ||= 'test'
3
- require File.expand_path("../dummy/config/environment", __FILE__)
4
- require "rspec/rails"
5
- require "rspec/active_model/mocks"
4
+ ENV['RAILS_ENV'] ||= 'test'
5
+ require File.expand_path('dummy/config/environment', __dir__)
6
+ require 'rspec/rails'
7
+ require 'rspec/active_model/mocks'
6
8
 
7
9
  RSpec.configure do |config|
8
10
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
- require "rails_helper"
2
- require "rspec/its"
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+ require 'rspec/its'
3
5
 
4
6
  # This file was generated by the `rails generate rspec:install` command. Conventionally, all
5
7
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
@@ -25,7 +27,7 @@ require "rspec/its"
25
27
  # run twice. It is recommended that you do not name files matching this glob to
26
28
  # end with _spec.rb. You can configure this pattern with with the --pattern
27
29
  # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
28
- Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) }
30
+ Dir['spec/support/**/*.rb'].each { |f| require File.expand_path(f) }
29
31
 
30
32
  RSpec.configure do |config|
31
33
  # config.include(Capybara::Webkit::RspecMatchers, :type => :feature)
@@ -71,7 +73,7 @@ RSpec.configure do |config|
71
73
  # Enable only the newer, non-monkey-patching expect syntax.
72
74
  # For more details, see:
73
75
  # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
74
- expectations.syntax = [:should, :expect]
76
+ expectations.syntax = %i[should expect]
75
77
  end
76
78
 
77
79
  # rspec-mocks config goes here. You can use an alternate test double
@@ -80,7 +82,7 @@ RSpec.configure do |config|
80
82
  # Enable only the newer, non-monkey-patching expect syntax.
81
83
  # For more details, see:
82
84
  # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
83
- mocks.syntax = [:should, :expect]
85
+ mocks.syntax = %i[should expect]
84
86
 
85
87
  # Prevents you from mocking or stubbing a method that does not exist on
86
88
  # a real object. This is generally recommended.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'factory_girl_rails'
2
4
 
3
5
  FactoryGirl.define do
@@ -11,4 +13,3 @@ FactoryGirl.define do
11
13
  sequence(:status) { |n| "status_#{n}" }
12
14
  end
13
15
  end
14
-
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec-html-matchers'
4
+
5
+ RSpec.configure do |config|
6
+ config.include RSpecHtmlMatchers
7
+ end