File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ def _wrap_steps_in_hash(steps)
144144 when Hash then steps
145145 when Transloadit ::Step then steps . to_hash
146146 else
147- if steps . uniq ( & :name ) != steps
147+ if steps . uniq != steps
148148 raise ArgumentError , "There are different Assembly steps using the same name"
149149 end
150150 steps . inject ( { } ) { |h , s | h . update s }
Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ def to_json
7979 MultiJson . dump ( to_hash )
8080 end
8181
82+ def eql? ( other )
83+ name == other . name
84+ end
85+
8286 protected
8387
8488 attr_writer :robot
Original file line number Diff line number Diff line change 211211 end
212212 end
213213
214+ describe "with multiple hash steps" do
215+ before do
216+ @encode = { "encode" : { "robot" : "/video/encode" } }
217+ @thumbs = { "thumbs" : { "robot" : "/video/thumbs" } }
218+
219+ @assembly = Transloadit ::Assembly . new @transloadit ,
220+ steps : [ @encode , @thumbs ]
221+ end
222+
223+ it "must wrap its steps into one hash" do
224+ _ ( @assembly . to_hash [ :steps ] . keys ) . must_include @encode . keys
225+ _ ( @assembly . to_hash [ :steps ] . keys ) . must_include @thumbs . keys
226+ end
227+
228+ it "must not allow duplicate steps" do
229+ thumbs = { "thumbs" : { "robot" : "/video/thumbs" } }
230+ thumbs_duplicate = { "thumbs" : { "robot" : "/video/encode" } }
231+ options = { steps : [ thumbs , thumbs_duplicate ] }
232+ assert_raises ArgumentError do
233+ @assembly . create! open ( "lib/transloadit/version.rb" ) , **options
234+ end
235+ end
236+ end
237+
214238 describe "using assembly API methods" do
215239 include WebMock ::API
216240
You can’t perform that action at this time.
0 commit comments