<commit_before>require "spec_helper"

describe "Release management" do
  let(:application1) { Application.new(name: "beavis", repo: "beavis.com") }
  let(:application2) { Application.new(name: "butthead", repo: "butthead.com") }

  let(:task1) { application1.tasks.create(version: "release_1") }
  let(:task2) { application2.tasks.create(version: "release_2") }
  let(:task3) { application2.tasks.create(version: "release_3") }

  before(:each) do
    application1.save
    application2.save

    task1.save
    task2.save
    task3.save
  end

  describe "showing release information" do
    let(:release1) { Release.new }
    let(:release2) { Release.new }

    before(:each) do
      release1.tasks << task1
      release1.tasks << task2
      release1.save

      release2.tasks << task3
      release2.save

      visit "/releases"
    end

    it "should have an OK response code" do
      page.status_code.should == 200
    end

    it "should show all releases" do
      page.body.should include(application1.name, application2.name)
    end
  end

  describe "creating releases" do
    before(:each) do
      visit "/releases"
      click_on "Create Release"
    end

    describe "list tasks" do

      it "should display a list of deployment tasks" do
        within("#release_tasks_input") do
          page.should have_content(task1.version)
          page.should have_content(task2.version)
          page.should have_content(task3.version)
        end
      end

      it "should hide deployment tasks already attached to a release" do
        release = Release.new
        release.tasks << task2
        release.save

        visit "/releases"
        click_on "Create Release"

        within("#release_tasks_input") do
          page.should_not have_content(task2.version)
        end
      end
    end

    describe "error cases" do
      it "should fail if no task is selected" do
        click_on "Create Release"

        page.should have_content("There are some problems with the release")
      end

      it "should fail if more than one task for the same application is selected"<commit_msg>Remove stub test for only one task per app per release<commit_after>require "spec_helper"

describe "Release management" do
  let(:application1) { Application.new(name: "beavis", repo: "beavis.com") }
  let(:application2) { Application.new(name: "butthead", repo: "butthead.com") }

  let(:task1) { application1.tasks.create(version: "release_1") }
  let(:task2) { application2.tasks.create(version: "release_2") }
  let(:task3) { application2.tasks.create(version: "release_3") }

  before(:each) do
    application1.save
    application2.save

    task1.save
    task2.save
    task3.save
  end

  describe "showing release information" do
    let(:release1) { Release.new }
    let(:release2) { Release.new }

    before(:each) do
      release1.tasks << task1
      release1.tasks << task2
      release1.save

      release2.tasks << task3
      release2.save

      visit "/releases"
    end

    it "should have an OK response code" do
      page.status_code.should == 200
    end

    it "should show all releases" do
      page.body.should include(application1.name, application2.name)
    end
  end

  describe "creating releases" do
    before(:each) do
      visit "/releases"
      click_on "Create Release"
    end

    describe "list tasks" do

      it "should display a list of deployment tasks" do
        within("#release_tasks_input") do
          page.should have_content(task1.version)
          page.should have_content(task2.version)
          page.should have_content(task3.version)
        end
      end

      it "should hide deployment tasks already attached to a release" do
        release = Release.new
        release.tasks << task2
        release.save

        visit "/releases"
        click_on "Create Release"

        within("#release_tasks_input") do
          page.should_not have_content(task2.version)
        end
      end
    end

    describe "error cases" do
      it "should fail if no task is selected" do
        click_on "Create Release"

        page.should have_content("There are some problems with the release")
      end
{'fraction_non_alphanumeric': 0.09255725190839695, 'fraction_numerical': 0.01717557251908397, 'mean_word_length': 2.6334488734835357, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, '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': '5913162', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1198, 'n_words': 353}