decko-commons/decko

View on GitHub
card/spec/support/helper/save_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Card
  module SpecHelper
    module SaveHelper
      include Card::Model::SaveHelper
      def create! name, content=""
        Card.create! name: name, content: content
      end

      def create name_or_args, content_or_args=nil
        Card::Auth.as_bot { super }
      end

      def create_card name_or_args, content_or_args=nil
        Card::Auth.as_bot { super }
      end

      def create_or_update name_or_args, content_or_args=nil
        Card::Auth.as_bot { super }
      end

      def update name_or_args, content_or_args={}
        Card::Auth.as_bot { super }
      end

      def update! name_or_args, content_or_args={}
        update_card name_or_args, content_or_args
      end

      def delete name
        Card::Auth.as_bot { Card[name].delete! }
      end
    end
  end
end