<commit_before>require 'spec_helper'

feature "post" do
  context "signed in user" do
    before(:each) do
      @user = FactoryGirl.create(:user)
      visit root_path
      click_link 'navbar-signin'
      fill_in 'Login', :with => @user.email
      fill_in 'Password', :with => <PASSWORD>
      click_button 'Sign in'
      visit sites_path
      click_link "Add a site"
      fill_in 'Address', :with => '1 Smith St'
      fill_in 'Suburb', :with => 'Smithville'
      click_button 'Create Site'
      @site = Site.last
    end

    scenario "post form appears on site page" do
      visit site_path(@site)
      expect(page).to have_selector("input[value='Post']")
    end

    context "posting an update about a site" do
      before :each do
        visit site_path(@site)
        fill_in "post_body", :with => "Here is some news about the garden. It's *awesome*."
        click_button "Post"
        @post = Post.last
      end

      scenario "post appears on site page" do
        current_path.should eq site_path(@site)
        page.should have_content "Here is some news"
        page.should have_content "#{@user.name} on"
      end

      # scenario "markdown help" do<commit_msg>use id for add site button<commit_after>require 'spec_helper'

feature "post" do
  context "signed in user" do
    before(:each) do
      @user = FactoryGirl.create(:user)
      visit root_path
      click_link 'navbar-signin'
      fill_in 'Login', :with => @user.email
      fill_in 'Password', :with => <PASSWORD>
      click_button 'Sign in'
      visit sites_path
      click_link "add-site"
      fill_in 'Address', :with => '1 Smith St'
      fill_in 'Suburb', :with => 'Smithville'
      click_button 'Create Site'
      @site = Site.last
    end

    scenario "post form appears on site page" do
      visit site_path(@site)
      expect(page).to have_selector("input[value='Post']")
    end

    context "posting an update about a site" do
      before :each do
        visit site_path(@site)
        fill_in "post_body", :with => "Here is some news about the garden. It's *awesome*."
        click_button "Post"
        @post = Post.last
      end

      scenario "post appears on site page" do
        current_path.should eq site_path(@site)
        page.should have_content "Here is some news"
        page.should have_content "#{@user.name} on"
      end

      # scenario "markdown help" do
{'fraction_non_alphanumeric': 0.10295956648603585, 'fraction_numerical': 0.0008336807002917883, 'mean_word_length': 2.5450516986706058, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3287302', 'n_tokens_mistral': 742, 'n_tokens_neox': 727, 'n_words': 240}