<commit_before>require File.dirname(__FILE__) + '/../spec_helper'

include ApplicationHelper 

describe ApplicationHelper do
  before do
    @user = Factory.create(:user)
    @person = Factory.create(:person)
    request.env['warden'] = mock_model(Warden, :authenticate? => @user, :authenticate! => @user, :authenticate => @user)
    sign_in @user
    @user.save
  end

  it "should specifiy if a post is not owned user" do
    p = Factory.create(:post, :person => @person)
    mine?(p).should be false
  end

  it "should specifiy if a post is owned current user" do
    ApplicatonHelper.any_instance.stub!(:current_user).and_return(@user)
    p = Factory.create(:post, :person => @user.person)
    
    puts p.person.id == @user.person.id
    
    mine?(p).should be true
  end

  it "should provide a correct show path for a given person" do
    person_url(@person).should == "/people/#{@person.id}"
  end

  it "should provide a correct show path for a given user" do
    person_url(@user).should == "/users/#{@user.id}"
  end
end<commit_msg>Working on devise mocking in helper specs<commit_after>require File.dirname(__FILE__) + '/../spec_helper'

include ApplicationHelper 
describe ApplicationHelper do
  before do
    @user = Factory.create(:user)
    @person = Factory.create(:person)
    #env['warden'] = mock_model(Warden, :authenticate? => @user, :authenticate! => @user, :authenticate => @user)
    sign_in @user
    @user.save
  end

  it "should specifiy if a post is not owned user" do
    p = Factory.create(:post, :person => @person)
    mine?(p).should be false
  end

  it "should specifiy if a post is owned current user" do
    p = Factory.create(:post, :person => @user.person)
    
    puts p.person.id == @user.person.id
    
    mine?(p).should be true
  end

  it "should provide a correct show path for a given person" do
    person_url(@person).should == "/people/#{@person.id}"
  end

  it "should provide a correct show path for a given user" do
    person_url(@user).should == "/users/#{@user.id}"
  end
end
{'fraction_non_alphanumeric': 0.12947523295733201, 'fraction_numerical': 0.0, 'mean_word_length': 3.463894967177243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5436802', 'n_tokens_mistral': 659, 'n_tokens_neox': 644, 'n_words': 202}