test/responder_test.rb in trailblazer-0.3.3 vs test/responder_test.rb in trailblazer-1.0.0.rc1
- old
+ new
@@ -3,11 +3,11 @@
class Song
extend ActiveModel::Naming
class Operation < Trailblazer::Operation
- include CRUD
+ include Model
model Song
include Responder
def process(params)
invalid! if params == false
@@ -18,11 +18,11 @@
module MyApp
class Song
extend ActiveModel::Naming
class Operation < Trailblazer::Operation
- include CRUD
+ include Model
include Responder
model Song
def process(params)
invalid! if params == false
@@ -44,12 +44,12 @@
it { Song::Operation.model_name.i18n_key.must_equal :"song" }
it { Song::Operation.model_name.route_key.must_equal "songs" }
it { Song::Operation.model_name.singular_route_key.must_equal "song" }
# #errors
- it { Song::Operation[true].errors.must_equal [] }
- it { Song::Operation[false].errors.must_equal [1] } # TODO: since we don't want responder to render anything, just return _one_ error. :)
+ it { Song::Operation.(true).errors.must_equal [] }
+ it { Song::Operation.(false).errors.must_equal [1] } # TODO: since we don't want responder to render anything, just return _one_ error. :)
# TODO: integration test with Controller.
end
@@ -66,10 +66,10 @@
it { MyApp::Song::Operation.model_name.i18n_key.must_equal :"my_app/song" }
it { MyApp::Song::Operation.model_name.route_key.must_equal "my_app_songs" } # "songs" for AR.
it { MyApp::Song::Operation.model_name.singular_route_key.must_equal "my_app_song" } # "song" for AR.
# #errors
- it { MyApp::Song::Operation[true].errors.must_equal [] }
- it { MyApp::Song::Operation[false].errors.must_equal [1] } # TODO: since we don't want responder to render anything, just return _one_ error. :)
+ it { MyApp::Song::Operation.(true).errors.must_equal [] }
+ it { MyApp::Song::Operation.(false).errors.must_equal [1] } # TODO: since we don't want responder to render anything, just return _one_ error. :)
# TODO: integration test with Controller.
end
\ No newline at end of file