spec/models/has_group_spec.rb in uploadcare-rails-1.0.0.rc4 vs spec/models/has_group_spec.rb in uploadcare-rails-1.0.1
- old
+ new
@@ -1,25 +1,35 @@
require "spec_helper"
describe :has_uploadcare_group do
+ before(:all) do
+ @file = File.open(File.join(File.dirname(__FILE__), 'view.png'))
+ @file2 = File.open(File.join(File.dirname(__FILE__), 'view2.jpg'))
+ @files_ary = [@file, @file2]
+ @files = UPLOADCARE_SETTINGS.api.upload @files_ary
+ @uploaded_group = UPLOADCARE_SETTINGS.api.create_group @files
+ @uuid = @uploaded_group.uuid
+ end
+
before(:each) do
- @post = PostWithCollection.new title: "Post title", file: " http://www.ucarecdn.com/19cde26d-e41b-4cf5-923e-f58729c0522a~2/"
+ @post = PostWithCollection.new title: "Post title", file: @uuid
+ @method = "file"
end
it "should respond to has_uploadcare_file? method" do
- @post.should respond_to(:has_uploadcare_file?)
+ @post.should respond_to("has_#{@method}_as_uploadcare_file?".to_sym)
end
it "should respond to has_uploadcare_group? method" do
- @post.should respond_to(:has_uploadcare_group?)
+ @post.should respond_to("has_#{@method}_as_uploadcare_group?".to_sym)
end
it ":has_uploadcare_file? should return true" do
- @post.has_uploadcare_file?.should == false
+ @post.has_file_as_uploadcare_file?.should == false
end
it ":has_uploadcare_group? should return false" do
- @post.has_uploadcare_group?.should == true
+ @post.has_file_as_uploadcare_group?.should == true
end
it "should have uploadcare file" do
@post.file.should be_kind_of(Uploadcare::Rails::Group)
end
\ No newline at end of file