spec/integration/remixable_spec.rb in dm-is-remixable-0.9.8 vs spec/integration/remixable_spec.rb in dm-is-remixable-0.9.9

- old
+ new

@@ -211,11 +211,11 @@ user.comments << comment user2.comments.length.should be(0) comment.commentor.first_name.should == "Testy" - + user.comments.length.should be(1) end # Example: # Articles are Commentable by many Users @@ -238,30 +238,30 @@ user.article_comments << ac article.comments.first.should be(ac) user.article_comments.first.should be(ac) end - + # Example: # Remixable Image add functionality to any class that remixes it # Image::RemixerClassMethods defines a method called 'total_images' that counts the total number of images for the class # Image::RemixerInstanceMethods defines a method called 'most_viewed_image' that find the most viewed image for an object # # User.remixes n, :images # User.total_images => count of all images owned by all users # User.first.most_viewed_image => would return the most viewed image - # + # it "should add a remixables' 'RemixerClassMethods' modules to the remixing class" do Article.respond_to?(:test_remixer_class_method).should be(true) Article.test_remixer_class_method.should == 'CLASS METHOD FOR REMIXER' end - + it "should add a remixables' 'RemixerInstanceMethods' modules to the remixing class" do Article.new.respond_to?(:test_remixer_instance_method).should be(true) Article.new.test_remixer_instance_method.should == 'INSTANCE METHOD FOR REMIXER' end - + # Example: # Remixable Image add functionality to any class that remixes it # Image::RemixeeClassMethods defines a method called 'damaged_files' would return a list of all images with invalid checksums (or whatev) # Image::RemixeeInstanceMethods defines a method called 'mime_type' that find the mime type of the particular image # @@ -272,52 +272,52 @@ # it "should add a remixables' 'RemixeeClassMethods' modules to the generated remixed class" do ArticleImage.respond_to?(:test_remixee_class_method).should be(true) ArticleImage.test_remixee_class_method.should == 'CLASS METHOD FOR REMIXEE' end - + it "should add a remixables' 'RemixeeInstanceMethods' modules to the generated remixed class" do ArticleImage.new.respond_to?(:test_remixee_instance_method).should be(true) ArticleImage.new.test_remixee_instance_method.should == 'INSTANCE METHOD FOR REMIXEE' end - + # Example: # User.remixes n, :images, :as => "pics" # User.first.pics would be the acessor for images # User.first.user_images should raise method not found # it 'should remove the original attribute accessor when attaching an optional one' do - Article.new.respond_to?(:pics).should be(true) + Article.new.respond_to?(:pics).should be(true) User.new.respond_to?(:user_addresses).should be(true) end - + # Currently: # Submission.remixes n, :comments # SubmissionComment.new.user = User.first => throws exception, accessor name is 'users' instead # # Example: - # User.remix 1, :images + # User.remix 1, :images # # => User.image & UserImage.user # - # User.remix n, :images + # User.remix n, :images # # => User.images & UserImage.user - # + # # User.remix n, :comments, :for => 'User', :via => 'commentor' # # => User.comments & UserComment.user & UserComment.commentor # it 'should pluralize accessor names with respect to cardinality' do pending end - + # Note: # Currently the :via flag allows one to specify another name for the field, but it always appends _id - # + # # Example: # User w/ PK being 'login_name' # User.remixes n, :comments, :for => 'User', :via => 'commentor' - # + # # Comment Table: - # * id + # * id # * text # * user_login_name # * commentor_id #=> should be able to specify it to be commentor_login_name # it 'should allow the primary and child field names to be specified while remixing' do