spec/examples/post_spec.rb in tumblr_client-0.8.1 vs spec/examples/post_spec.rb in tumblr_client-0.8.2
- old
+ new
@@ -102,23 +102,35 @@
}.should raise_error ArgumentError
end
end
- context 'when passing data different ways' do
-
+ context 'when passing data as an array of filepaths' do
before do
fakefile = OpenStruct.new :read => file_data
File.stub(:open).with(file_path + '.jpg').and_return(fakefile)
client.should_receive(:post).once.with("v2/blog/#{blog_name}/post", {
'data[0]' => kind_of(Faraday::UploadIO),
:type => type.to_s
}).and_return('post')
end
-
+
it 'should be able to pass data as an array of filepaths' do
r = client.send type, blog_name, :data => [file_path + ".jpg"]
r.should == 'post'
+ end
+
+ end
+
+ context 'when passing data different ways' do
+
+ before do
+ fakefile = OpenStruct.new :read => file_data
+ File.stub(:open).with(file_path + '.jpg').and_return(fakefile)
+ client.should_receive(:post).once.with("v2/blog/#{blog_name}/post", {
+ 'data' => kind_of(Faraday::UploadIO),
+ :type => type.to_s
+ }).and_return('post')
end
it 'should be able to pass data as a single filepath' do
r = client.send type, blog_name, :data => file_path + ".jpg"
r.should == 'post'