<commit_before>require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))

startup_merb(
  :merb_root => File.dirname(__FILE__) / "test_app",
  :gemfile   => File.dirname(__FILE__) / "test_app" / "Gemfile",
  :fork_for_class_load => false
)
Merb::Config[:log_stream] = File.open("/dev/null", "w")
Merb.reset_logger!

describe "an app tested using the webrat proxies" do
  describe("#visits") do
    it "supports visits" do
      visits("/testing")
    end
  
    it "can use the Merb expectations with visits" do
      visits("/testing").should be_successful
    end
  
    it "supports visits intermixed with request" do
      request("/testing")
      resp = visits("/testing/next")
      resp.should have_xpath("//p")
    end
  end
  
  describe("#click_link") do
    it "supports click_link" do
      visit "/testing"
      click_link "Next"
    end
    
    it "can use the Merb expectations with click_link" do
      visit "/testing"
      resp = click_link "Next"
      resp.should have_xpath("//p[contains(., 'Got to next')]")
    end
    
    it "supports click_link after a request" do
      request("/testing")
      resp = click_link "Next"
      resp.should have_xpath("//p[contains(., 'Got to next')]")
    end
  end<commit_msg>[merb-core] Cleaning up webrat specs to support webrat-0.6<commit_after>require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))

startup_merb(
  :merb_root => File.dirname(__FILE__) / "test_app",
  :gemfile   => File.dirname(__FILE__) / "test_app" / "Gemfile",
  :fork_for_class_load => false
)
Merb::Config[:log_stream] = File.open("/dev/null", "w")
Merb.reset_logger!

describe "an app tested using the webrat proxies" do
  describe("#visit") do
    it "supports visit" do
      visit("/testing")
    end
  
    it "can use the Merb expectations with visit" do
      visit("/testing").should be_successful
    end
  
    it "supports visit intermixed with request" do
      resp = visit("/testing/next")
      resp.should have_xpath("//p")
    end
  end
  
  describe("#click_link") do
    it "supports click_link" do
      visit "/testing"
      click_link "Next"
    end
    
    it "can use the Merb expectations with click_link" do
      visit "/testing"
      resp = click_link "Next"
      resp.should have_xpath("//p[contains(., 'Got to next')]")
    end
  end
{'fraction_non_alphanumeric': 0.12915601023017903, 'fraction_numerical': 0.0008525149190110827, 'mean_word_length': 3.067590987868284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6254540', 'n_tokens_mistral': 787, 'n_tokens_neox': 777, 'n_words': 206}