Kouhei Sutou
null+****@clear*****
Wed Mar 23 11:17:03 JST 2016
Kouhei Sutou 2016-03-23 11:17:03 +0900 (Wed, 23 Mar 2016) New Revision: 8feea86750e6df46318b2843cc0560333c284751 https://github.com/ranguba/groonga-client-rails/commit/8feea86750e6df46318b2843cc0560333c284751 Message: Support RSpec Copied files: lib/groonga/client/rails/spec_helper.rb (from lib/groonga/client/rails/fixture.rb) Modified files: lib/groonga/client/rails/fixture.rb Modified: lib/groonga/client/rails/fixture.rb (+15 -5) =================================================================== --- lib/groonga/client/rails/fixture.rb 2016-03-23 11:15:54 +0900 (47c53f7) +++ lib/groonga/client/rails/fixture.rb 2016-03-23 11:17:03 +0900 (f08d585) @@ -23,12 +23,22 @@ module Groonga extend ActiveSupport::Concern included do - setup do - setup_groonga - end + if singleton_class.method_defined?(:setup) + setup do + setup_groonga + end + + teardown do + teardown_groonga + end + elsif singleton_class.method_defined?(:before) + before(:each) do + setup_groonga + end - teardown do - teardown_groonga + after(:each) do + teardown_groonga + end end end Copied: lib/groonga/client/rails/spec_helper.rb (+1 -31) 56% =================================================================== --- lib/groonga/client/rails/fixture.rb 2016-03-23 11:15:54 +0900 (47c53f7) +++ lib/groonga/client/rails/spec_helper.rb 2016-03-23 11:17:03 +0900 (4195e68) @@ -14,34 +14,4 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -require "groonga/client/rails/groonga_server_runner" - -module Groonga - class Client - module Rails - module Fixture - extend ActiveSupport::Concern - - included do - setup do - setup_groonga - end - - teardown do - teardown_groonga - end - end - - def setup_groonga - @groonga_server_runner = GroongaServerRunner.new - @groonga_server_runner.run - end - - def teardown_groonga - return if @groonga_server_runner.nil? - @groonga_server_runner.stop - end - end - end - end -end +require "groonga/client/rails/fixture" -------------- next part -------------- HTML����������������������������...Download