File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
elasticsearch-rails/lib/rails/templates Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 184
184
class Article < ActiveRecord::Base
185
185
include Elasticsearch::Model
186
186
include Elasticsearch::Model::Callbacks
187
+ #{ 'attr_accessible :title, :content, :published_on' if Rails ::VERSION ::STRING < '4' }
187
188
end
188
189
CODE
189
190
@@ -236,7 +237,7 @@ def search
236
237
end
237
238
CODE
238
239
239
- gsub_file ' test/controllers/ articles_controller_test.rb' , %r{setup do.*?end}m , <<-CODE
240
+ gsub_file " #{ Rails :: VERSION :: STRING > '4' ? ' test/controllers' : 'test/functional' } / articles_controller_test.rb" , %r{setup do.*?end}m , <<-CODE
240
241
setup do
241
242
@article = articles(:one)
242
243
@@ -245,7 +246,7 @@ def search
245
246
end
246
247
CODE
247
248
248
- inject_into_file ' test/controllers/ articles_controller_test.rb' , after : %r{test "should get index" do.*?end}m do
249
+ inject_into_file " #{ Rails :: VERSION :: STRING > '4' ? ' test/controllers' : 'test/functional' } / articles_controller_test.rb" , after : %r{test "should get index" do.*?end}m do
249
250
<<-CODE
250
251
251
252
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ def self.search(query)
86
86
end
87
87
CODE
88
88
89
- gsub_file "test/models/article_test.rb" , %r{# test "the truth" do.*?# end}m , <<-CODE
89
+ gsub_file "#{ Rails :: VERSION :: STRING > '4' ? ' test/models' : 'test/unit' } /article_test.rb" , %r{# test "the truth" do.*?# end}m , <<-CODE
90
90
91
91
test "has a search method delegating to __elasticsearch__" do
92
92
Article.__elasticsearch__.expects(:search).with do |definition|
@@ -98,7 +98,7 @@ def self.search(query)
98
98
CODE
99
99
100
100
git add : "app/models/article.rb"
101
- git add : "test/models /article_test.rb"
101
+ git add : "test/** /article_test.rb"
102
102
git commit : "-m 'Added an `Article.search` method'"
103
103
104
104
# ----- Add loading Bootstrap assets --------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments