<commit_before># == Schema Information
#
# Table name: projects
#
#  created_at :datetime
#  id         :integer          not null, primary key
#  name       :string(255)
#  notes      :text
#  updated_at :datetime
#  user_id    :integer
#

class Project < ActiveRecord::Base
  has_many :apps
  has_many :requirements, through: :apps
  has_many :expectations, through: :requirements
  has_many :spec_runs
  belongs_to :user

  validates :user, presence: true

  def to_rspec
    result = <<-END.strip_heredoc
      #
      # #{rspec_filename}
      #
      # To run these tests;
      #   1. Install Ruby >= 2.0.0
      #   2. Install RSpec: $ gem install rspec-webservice_matchers
      #   3. Save this page as "#{rspec_filename}"
      #   4. Run RSpec:     $ rspec ./#{rspec_filename}
      #
      # Detailed instructions: http://think200.com/rspec-faq
      # Generated on #{Time.zone.now.to_s(:db)}
      #
      require 'rspec/webservice_matchers'

      describe '#{name}' do
    END
      # apps.each { |e| result += e.to_rspec.indent(2) }
      contexts = apps.map { |a| a.to_rspec.indent(2) }
      result + contexts.join("\n") + "end\n"
    end

    def to_plaintext
      result = "Project \"#{name}\":\n"
      apps.each { |e| result += e.to_plaintext.indent(2) }
      result
    end

    def owned_by?(user)<commit_msg>small rspec formatting change<commit_after># == Schema Information
#
# Table name: projects
#
#  created_at :datetime
#  id         :integer          not null, primary key
#  name       :string(255)
#  notes      :text
#  updated_at :datetime
#  user_id    :integer
#

class Project < ActiveRecord::Base
  has_many :apps
  has_many :requirements, through: :apps
  has_many :expectations, through: :requirements
  has_many :spec_runs
  belongs_to :user

  validates :user, presence: true

  def to_rspec
    result = <<-END.strip_heredoc
      #
      # #{rspec_filename}
      #
      # To run these tests:
      #
      #   1. Install Ruby >= 2.0.0
      #   2. Install RSpec: $ gem install rspec-webservice_matchers
      #   3. Save this page as "#{rspec_filename}"
      #   4. Run RSpec:     $ rspec ./#{rspec_filename}
      #
      # Detailed instructions: http://think200.com/rspec-faq
      # Generated on #{Time.zone.now.to_s(:db)}
      #
      require 'rspec/webservice_matchers'

      describe '#{name}' do
    END
      # apps.each { |e| result += e.to_rspec.indent(2) }
      contexts = apps.map { |a| a.to_rspec.indent(2) }
      result + contexts.join("\n") + "end\n"
    end

    def to_plaintext
      result = "Project \"#{name}\":\n"
      apps.each { |e| result += e.to_plaintext.indent(2) }
      result
    end

    def owned_by?(user)
{'fraction_non_alphanumeric': 0.12648367952522255, 'fraction_numerical': 0.011869436201780416, 'mean_word_length': 2.342007434944238, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '313833', 'n_tokens_mistral': 949, 'n_tokens_neox': 926, 'n_words': 222}