<commit_before>require 'rails_helper'

RSpec.describe IdeasController, :type => :controller do
    let(:user){ FactoryGirl.create(:user) }
    let(:user_admin){ FactoryGirl.create(:user_admin) }
    let(:user_moderator){ FactoryGirl.create(:user_moderator) }

  it "can be published by moderator" do
    session[:user_id] = :user_moderator
    idea = FactoryGirl.create(:idea)
    # Correct way to use publish is missing
    # expect(idea.histories.last.basket).to eq("Approved")
  end

#TODO
  it "cannot be published by non-moderator" do
    idea = FactoryGirl.create(:idea)
  end

  it "cannot be updated if not signed it or whatnot wrong test" do
    idea = FactoryGirl.create(:idea)
  end<commit_msg>Make test for publish controller<commit_after>require 'rails_helper'

RSpec.describe IdeasController, :type => :controller do
    let(:user){ FactoryGirl.create(:user) }
    let(:user_admin){ FactoryGirl.create(:user_admin) }
    let(:user_moderator){ FactoryGirl.create(:user_moderator) }

    it "can be published by moderator" do
	    session[:user_id] = user_moderator.id
	    idea = FactoryGirl.create(:idea)
	    expect{post :publish, id: idea.id}.to change(History,:count).by(1)
    # Correct way to use publish is missing
    # expect(idea.histories.last.basket).to eq("Approved")
  end

#TODO
  it "cannot be published by non-moderator" do
    idea = FactoryGirl.create(:idea)
  end

  it "cannot be updated if not signed it or whatnot wrong test" do
    idea = FactoryGirl.create(:idea)
  end
{'fraction_non_alphanumeric': 0.11280690112806901, 'fraction_numerical': 0.0006635700066357001, 'mean_word_length': 4.18213058419244, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1070462', 'n_tokens_mistral': 505, 'n_tokens_neox': 471, 'n_words': 134}