<commit_before># -*- encoding : utf-8 -*-
require 'spec_helper'

describe NotesController do
  before do
    make_a_typical_project

    @page = @project.new_page(@owner, {:name => 'New Employee Information'})
    @page.save!

    @note = @page.build_note({:name => 'Office Ettiquete'}).tap do |n|
      n.updated_by = @owner
      n.save
    end
  end

  describe "#create" do
    it "should allow participants to create notes" do
      login_as @user

      post :create, :project_id => @project.permalink, :page_id => @page.id, :note => {:name => 'Important!'}
      response.should redirect_to(project_page_path(@project,@page))

      @page.notes(true).length.should == 2
      @page.notes.last.name.should == 'Important!'
    end

    it "should insert notes at the top of a page" do
      login_as @user

      post :create,
           :project_id => @project.permalink,
           :page_id => @page.id,
           :note => {:name => 'AT_TOP'},
           :position => {:slot => 0, :before => true}<commit_msg>more readable spec<commit_after># -*- encoding : utf-8 -*-
require 'spec_helper'

describe NotesController do
  before do
    make_a_typical_project

    @page = @project.new_page(@owner, {:name => 'New Employee Information'})
    @page.save!

    @note = @page.build_note({:name => 'Office Ettiquete'}).tap do |n|
      n.updated_by = @owner
      n.save
    end
  end

  describe "#create" do
    it "should allow participants to create notes" do
      login_as @user

      post :create,
        :project_id => @project.permalink,
        :page_id => @page.id,
        :note => {:name => 'Important!'}
      response.should be_success
      response.should redirect_to project_page_path( @project, @page )

      @page.notes(true).length.should == 2
      @page.notes.last.name.should == 'Important!'
    end

    it "should insert notes at the top of a page" do
      login_as @user

      post :create,
           :project_id => @project.permalink,
           :page_id => @page.id,
           :note => {:name => 'AT_TOP'},
           :position => {:slot => 0, :before => true}
{'fraction_non_alphanumeric': 0.1415633937082936, 'fraction_numerical': 0.002859866539561487, 'mean_word_length': 2.594178082191781, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '7475003', 'n_tokens_mistral': 698, 'n_tokens_neox': 661, 'n_words': 176}