File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
spec/unit/spark_api/models Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,12 @@ def rollback(version)
59
59
connection . put "#{ update_path } /#{ self . Id } /versions/current" , payload
60
60
end
61
61
62
- def rotate ( direction )
63
- payload = { 'Photos' => [ { 'Rotate' => direction } ] }
62
+
63
+ def rotate! ( direction )
64
+ unless [ :clockwise , :counterclockwise ] . include? direction . to_sym
65
+ raise ArgumentError , "Photo rotate failed. '#{ direction } ' is not supported."
66
+ end
67
+ payload = { 'Photos' => [ { 'Rotate' => direction . to_s } ] }
64
68
connection . put "#{ self . update_path } /#{ self . Id } " , payload
65
69
end
66
70
Original file line number Diff line number Diff line change 84
84
on_put_it "should rotate a photo" do
85
85
stub_api_put ( '/listings/1234/photos/20110826220032167405000000' , 'listings/photos/rotate.json' , 'success.json' )
86
86
subject . Id = "20110826220032167405000000"
87
- subject . rotate ( 'clockwise' )
87
+ subject . rotate! ( 'clockwise' )
88
+ end
89
+
90
+ on_put_it "should raise an exception for an invalid rotate parameter" do
91
+ stub_api_put ( '/listings/1234/photos/20110826220032167405000000' , 'listings/photos/rotate.json' , 'success.json' )
92
+ subject . Id = "20110826220032167405000000"
93
+ expect { subject . rotate! ( 'left' ) } . to raise_error ( ArgumentError )
88
94
end
89
95
90
96
on_delete_it "should delete a photo" do
You can’t perform that action at this time.
0 commit comments