Sha256: c486dca055fb5845753153ac96fe9a69f9dc6ddeaeed9cbc4483b9ed38ca5833

Contents?: true

Size: 821 Bytes

Versions: 11

Compression:

Stored size: 821 Bytes

Contents

require "authlogic/test_case"

class GroupMessagesDataset < Dataset::Base
  datasets = [:groups]
  datasets << :group_sites if defined? Site
  uses *datasets

  def load
    create_message "Normal"
    create_message "Grouped", :group => groups(:normal)
  end

  helpers do
    def create_message(subject, attributes={})
      attributes = message_attributes(attributes.update(:subject => subject))
      message = create_model Message, subject.symbolize, attributes
    end

    def message_attributes(attributes={})
      subject = attributes[:subject] || "Message"
      symbol = subject.symbolize
      attributes = { 
        :subject => subject,
        :body => "This is the #{subject} message"
      }.merge(attributes)
      attributes[:site] = sites(:test) if defined? Site
      attributes
    end

  end
 
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
radiant-reader_group-extension-1.2.4 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.2.3 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.2.2 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.2.1 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.2.0 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.1.2 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.1.1 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.1.0 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.0.1 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-1.0.0 spec/datasets/group_messages_dataset.rb
radiant-reader_group-extension-0.9.0 spec/datasets/group_messages_dataset.rb