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

describe "/proposals/show.html.erb" do
  before do
    @controller.stub!('can_edit?').and_return(false)
  end
  
  before :each do
    @users = []
    @users.stub!(:by_name).and_return([])
    
    @proposal = stub_model(Proposal, :status => "proposed", :users => @users)
    @event = stub_model(Event, :id => 1, :title => "Event 1", :proposal_status_published => false);
    @controller.stub!(:schedule_visible? => true)
  end
  
  %w[accepted confirmed rejected junk].each do |status|
    it "should not show the status for #{status} proposals if statuses are not published" do
      @event.proposal_status_published = false
      @proposal.status = status
      
      assigns[:event]  = @event
      assigns[:proposal] = @proposal
      assigns[:kind] = :proposal
    
      render "/proposals/show.html.erb"
      response.should_not have_tag("div.proposal-status #{status}")
    end
  end
  
  it "should show the proposal status for a confirmed proposal if statuses are published" do
    @event.proposal_status_published = true
    @proposal.status = 'confirmed'
    
    assigns[:event]  = @event
    assigns[:proposal] = @proposal
    assigns[:kind] = :proposal<commit_msg>Updated proposals#show spec to use factories.<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/proposals/show.html.erb" do
  before do
    @controller.stub!('can_edit?').and_return(false)
  end
  
  before :each do
    @user = Factory :user
    @event = Factory :populated_event, :proposal_status_published => false
    @proposal = proposal_for_event(@event, :users => [@user])

    @controller.stub!(:schedule_visible? => true)
  end
  
  %w[accepted confirmed rejected junk].each do |status|
    it "should not show the status for #{status} proposals if statuses are not published" do
      @event.proposal_status_published = false
      @proposal.status = status
      
      assigns[:event]  = @event
      assigns[:proposal] = @proposal
      assigns[:kind] = :proposal
    
      render "/proposals/show.html.erb"
      response.should_not have_tag("div.proposal-status #{status}")
    end
  end
  
  it "should show the proposal status for a confirmed proposal if statuses are published" do
    @event.proposal_status_published = true
    @proposal.status = 'confirmed'
    
    assigns[:event]  = @event
    assigns[:proposal] = @proposal
    assigns[:kind] = :proposal
{'fraction_non_alphanumeric': 0.12464929859719438, 'fraction_numerical': 0.0008016032064128256, 'mean_word_length': 3.425531914893617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '2967840', 'n_tokens_mistral': 788, 'n_tokens_neox': 785, 'n_words': 191}