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

describe ApplicationController do
  include ActionController::UrlWriter

  before do
    ApplicationController.send(:include, ActionController::UrlWriter)
  end

  describe "with a logged in citizen" do
    before do
      controller.stub!(:logged_in?).and_return(true)
      controller.stub!(:current_user).and_return(Factory(:user, :type => 'Citizen'))
    end

    it "'start a story' should link to the new tip path" do
      controller.start_story_path.should == new_tip_path
    end
  end

  describe "with a logged in reporter" do
    before do
      controller.stub!(:logged_in?).and_return(true)
      controller.stub!(:current_user).and_return(Factory(:user, :type => 'Reporter'))
    end

    it "'start a story' should link to the new pitch path" do
      controller.start_story_path.should == new_pitch_path
    end
  end

  describe "with a guest user" do
    before do
      controller.stub!(:logged_in?).and_return(false)
      controller.stub!(:current_user).and_return(nil)
    end

    it "'start a story' should link to the new tip path" do
      controller.start_story_path.should == new_tip_path
    end
  end
end<commit_msg>Fixed the spec for start_story_path (+jferris)<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe ApplicationController do

  describe "with a logged in citizen" do
    before do
      controller.stub!(:logged_in?).and_return(true)
      user = User.find(Factory(:user, :type => 'Citizen').to_param)
      violated "user must be a citizen" unless Citizen === user
      controller.stub!(:current_user).and_return(user)
    end

    it "'start a story' should link to the new tip path" do
      controller.should_receive(:new_tip_path).and_return('new tip')
      controller.start_story_path.should == 'new tip'
    end
  end

  describe "with a logged in reporter" do
    before do
      controller.stub!(:logged_in?).and_return(true)
      user = User.find(Factory(:user, :type => 'Reporter').to_param)
      violated "user must be a reporter" unless Reporter === user
      controller.stub!(:current_user).and_return(user)
    end

    it "'start a story' should link to the new pitch path" do
      controller.should_receive(:new_pitch_path).and_return('new pitch')
      controller.start_story_path.should == 'new pitch'
    end
  end

  describe "with a guest user" do
    before do
      controller.stub!(:logged_in?).and_return(false)
      controller.stub!(:current_user).and_return(nil)
    end

    it "'start a story' should link to the new tip path" do
      controller.should_receive(:new_tip_path).and_return('new tip')
      controller.start_story_path.should == 'new tip'
    end
  end
end
{'fraction_non_alphanumeric': 0.10619150467962563, 'fraction_numerical': 0.0, 'mean_word_length': 3.631666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3814659', 'n_tokens_mistral': 856, 'n_tokens_neox': 836, 'n_words': 230}