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

describe "/iterations/new" do
  describe "first visit" do
    before :each do
      @story = Stories.iteration_planning!
      assigns[:project] = @story.project
      assigns[:iteration] = @story.project.iterations.build
      render 'iterations/new'
    end

    it_should_behave_like "a standard view"

    it "should have a form to create an iteration" do
      response.should have_tag('form[action=?][method=?]', 
                               project_iterations_path(assigns[:project]),
                             'post')
    end
  end

  describe "on error" do
    before :each do
      @story = Stories.iteration_planning_included!
      @iteration = mock_model(Iteration, 
                              :duration => '',
                              :name => '', 
                              :stories => [@story])
      assigns[:project] = @story.project
      assigns[:iteration] = @iteration
      render 'iterations/new'
    end

    it "should set the included value for the assigned stories" do
      selector = "input#stories_#{@story.id}_include[checked='checked']"
      response.should have_tag(selector)
    end

    it "should set the estimate value" do
      selector = "input#stories_#{@story.id}_estimate[value=#{@story.estimate}]"
      response.should have_tag(selector)
    end
  end
end<commit_msg>unobjectmotherified iterations/new spec<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "/iterations/new" do
  before :each do
    @story = mock_model(Story,
                        :name => '',
                        :content => '',
                        :estimate => '',
                        :project => @project)
    @project = mock_model(Project,
                          :stories => [@story])
    @iteration = mock_model(Iteration, 
                            :duration => '',
                            :name => '',
                            :stories => [],
                            :new_record? => true)
  end

  describe "first visit" do
    before :each do
      assigns[:project] = @project
      assigns[:iteration] = @iteration
      render 'iterations/new'
    end

    it_should_behave_like "a standard view"

    it "should have a form to create an iteration" do
      response.should have_tag('form[action=?][method=?]', 
                               project_iterations_path(assigns[:project]),
                               'post')
    end
  end

  describe "on error" do
    before :each do
      @iteration.stub!(:stories).and_return([@story])
      assigns[:project] = @project
      assigns[:iteration] = @iteration
      render 'iterations/new'
    end

    it "should set the included value for the assigned stories" do
      selector = "input#stories_#{@story.id}_include[checked='checked']"
      response.should have_tag(selector)
    end

    it "should set the estimate value" do
      selector = "input#stories_#{@story.id}_estimate[value=#{@story.estimate}]"
      response.should have_tag(selector)
    end
  end
end
{'fraction_non_alphanumeric': 0.11469648562300319, 'fraction_numerical': 0.0, 'mean_word_length': 2.0398058252427185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5000704', 'n_tokens_mistral': 885, 'n_tokens_neox': 862, 'n_words': 202}