<commit_before>require 'spec_helper'

describe "Languages controller" do  
  before(:each) do
    FactoryGirl.create(:language)
    50.times {FactoryGirl.create(:word)}
  end

  describe "index page" do
    it "renders the index" do
      visit languages_path
      expect(page).to have_text("Learn the languages of the world the efficient way: by applying the 80/20 rule. Since 80% of a person's daily conversation is derived from roughly 20% of his or her vocabulary, focusing on the most frequently used words is a helpful approach to learning a foreign language.")
    end

    it "includes languages in the dropdown menu" do
      visit languages_path
      expect(page).to have_text("French")
    end
  end

  describe "languages show page" do
    it "includes languages in the dropdown menu" do
      visit language_path(1)
      expect(page).to have_text("#{Language.first.name}")
      expect(page).to have_text("#{Word.first.word}")
    end
  end

  describe "random language page" do
    it "redirects to a language show page" do
      visit languages_path
      click_link("Random language")
      expect(page).to have_text("#{Language.first.name}")
      expect(page).to have_text("#{Word.first.word}")
    end
  end

  describe "game" do
    it "renders the game" do
      visit game_path
      expect(page).to have_text("Test your knowledge!")
    end

    it "gets words for a game in a given language" do
      # Test languages_controller's get_set_of_words method
    end
  end
end<commit_msg>Add test coverage to #get_word_data and #choose_language<commit_after>require 'spec_helper'

describe "Languages controller" do  
  before(:each) do
    FactoryGirl.create(:language)
    50.times {FactoryGirl.create(:word)}
  end

  describe "index page" do
    it "renders the index" do
      visit languages_path
      expect(page).to have_text("Learn the languages of the world the efficient way: by applying the 80/20 rule. Since 80% of a person's daily conversation is derived from roughly 20% of his or her vocabulary, focusing on the most frequently used words is a helpful approach to learning a foreign language.")
    end

    it "includes languages in the dropdown menu" do
      visit languages_path
      expect(page).to have_text("French")
    end
  end

  describe "languages show page" do
    it "includes languages in the dropdown menu" do
      visit language_path(1)
      expect(page).to have_text("#{Language.first.name}")
      expect(page).to have_text("#{Word.first.word}")
    end
  end

  describe "show language after redirect" do
    it "includes language selected" do
      visit choose_language_path(1)
      visit("/languages/1?per_page=25")
      expect(page).to have_text("#{Language.first.name}")
      expect(page).to have_text("#{Word.first.word}")
    end
  end

  describe "random language page" do
    it "redirects to a language show page" do
      visit languages_path
      click_link("Random language")
      expect(page).to have_text("#{Language.first.name}")
      expect(page).to have_text("#{Word.first.word}")
    end
  end

  describe "game" do
    it "renders the game" do
      visit game_path
      expect(page).to have_text("Test your knowledge!")
    end

    it "routes correctly to GET #get_word_data" do
      visit game_words_path
    end

    it "gets words for a game in a given language" do
      # Test languages_controller's get_set_of_words method
    end
  end
end
{'fraction_non_alphanumeric': 0.08633720930232558, 'fraction_numerical': 0.007558139534883721, 'mean_word_length': 3.2851805728518055, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1996924', 'n_tokens_mistral': 1023, 'n_tokens_neox': 979, 'n_words': 361}