Skip to content
Permalink
Browse files

retire webrat for good, use capybara in functionals

  • Loading branch information...
nickrivadeneira committed Jul 25, 2011
1 parent e012d9f commit 1a6a38c8d7515b7a00d4749fa1f3c638fb7e4a32
@@ -24,6 +24,9 @@ gem 'yajl-ruby', :require => 'yajl/json_gem'

platforms :ruby_18 do
gem 'system_timer'
group :test do
gem 'redgreen'
end
end

platforms :jruby do
@@ -51,5 +54,4 @@ group :test do
gem 'shoulda'
gem 'timecop'
gem 'webmock'
gem 'webrat'
end
@@ -129,6 +129,7 @@ GEM
thor (~> 0.14.4)
rake (0.9.2)
rdoc (3.8)
redgreen (1.2.2)
redis (2.2.1)
rest-client (1.6.3)
mime-types (>= 1.16)
@@ -158,10 +159,6 @@ GEM
webmock (1.6.4)
addressable (> 2.2.5, ~> 2.2)
crack (>= 0.1.7)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (3.0.pre2)
xml-simple (1.1.0)
xpath (0.1.4)
@@ -194,6 +191,7 @@ DEPENDENCIES
rack-test
rails (~> 3.0.9)
rdoc
redgreen
redis
rest-client
rr
@@ -204,7 +202,6 @@ DEPENDENCIES
timecop
validates_url_format_of
webmock
webrat
will_paginate (~> 3.0.pre2)
xml-simple
yajl-ruby

This file was deleted.

Oops, something went wrong.
@@ -5,7 +5,7 @@ class Api::V1::WebHooksControllerTest < ActionController::TestCase
def self.should_not_find_it
should respond_with :not_found
should "say gem is not found" do
assert_contain "could not be found"
assert page.has_content?("could not be found")
end
end

@@ -56,7 +56,7 @@ def self.should_not_find_it
end
should respond_with :success
should "say successfully deployed" do
assert_contain "Successfully deployed webhook for #{@gemcutter.name} to #{@url}"
assert page.has_content?("Successfully deployed webhook for #{@gemcutter.name} to #{@url}")
assert WebHook.count.zero?
end
end
@@ -69,7 +69,7 @@ def self.should_not_find_it
end
should respond_with :bad_request
should "say successfully deployed" do
assert_contain "There was a problem deploying webhook for #{@gemcutter.name} to #{@url}"
assert page.has_content?("There was a problem deploying webhook for #{@gemcutter.name} to #{@url}")
assert WebHook.count.zero?
end
end
@@ -89,7 +89,7 @@ def self.should_not_find_it
end
should respond_with :success
should "say successfully deployed" do
assert_contain "Successfully deployed webhook for #{@rubygem.name} to #{@url}"
assert page.has_content?("Successfully deployed webhook for #{@rubygem.name} to #{@url}")
assert WebHook.count.zero?
end
end
@@ -102,7 +102,7 @@ def self.should_not_find_it
end
should respond_with :bad_request
should "say there was a problem" do
assert_contain "There was a problem deploying webhook for #{@rubygem.name} to #{@url}"
assert page.has_content?("There was a problem deploying webhook for #{@rubygem.name} to #{@url}")
assert WebHook.count.zero?
end
end
@@ -161,7 +161,7 @@ def self.should_not_find_it

should respond_with :success
should "say webhook was removed" do
assert_contain "Successfully removed webhook for #{@rubygem.name} to #{@rubygem_hook.url}"
assert page.has_content?("Successfully removed webhook for #{@rubygem.name} to #{@rubygem_hook.url}")
end
should "have actually removed the webhook" do
assert_raise ActiveRecord::RecordNotFound do
@@ -179,7 +179,7 @@ def self.should_not_find_it

should respond_with :success
should "say webhook was removed" do
assert_contain "Successfully removed webhook for all gems to #{@global_hook.url}"
assert page.has_content?("Successfully removed webhook for all gems to #{@global_hook.url}")
end
should "have actually removed the webhook" do
assert_raise ActiveRecord::RecordNotFound do
@@ -208,7 +208,7 @@ def self.should_not_find_it

should respond_with :not_found
should "say webhook was not found" do
assert_contain "No such webhook exists under your account."
assert page.has_content?("No such webhook exists under your account.")
end
should "not delete the webhook" do
assert_not_nil WebHook.find(@rubygem_hook.id)
@@ -224,7 +224,7 @@ def self.should_not_find_it

should respond_with :not_found
should "say webhook was not found" do
assert_contain "No such webhook exists under your account."
assert page.has_content?("No such webhook exists under your account.")
end
should "not delete the webhook" do
assert_not_nil WebHook.find(@rubygem_hook.id)
@@ -239,7 +239,7 @@ def self.should_not_find_it

should respond_with :created
should "say webhook was created" do
assert_contain "Successfully created webhook for #{@rubygem.name} to #{@url}"
assert page.has_content?("Successfully created webhook for #{@rubygem.name} to #{@url}")
end
should "link webhook to current user and rubygem" do
assert_equal @user, WebHook.last.user
@@ -256,7 +256,7 @@ def self.should_not_find_it
should respond_with :conflict
should "be only 1 web hook" do
assert_equal 1, WebHook.count
assert_contain "#{@url} has already been registered for #{@rubygem.name}"
assert page.has_content?("#{@url} has already been registered for #{@rubygem.name}")
end
end

@@ -271,7 +271,7 @@ def self.should_not_find_it
assert_nil WebHook.last.rubygem
end
should "respond with message that global hook was made" do
assert_contain "Successfully created webhook for all gems to #{@url}"
assert page.has_content?("Successfully created webhook for all gems to #{@url}")
end
end
end
@@ -24,8 +24,8 @@ class DashboardsControllerTest < ActionController::TestCase
should assign_to(:my_gems) { @gems }
should "render links" do
@gems.each do |g|
assert_contain g.name
assert_have_selector "a[href='#{rubygem_path(g)}'][title='#{g.versions.most_recent.info}']"
assert page.has_content?(g.name)
assert page.has_selector?("a[href='#{rubygem_path(g)}'][title='#{g.versions.most_recent.info}']")
end
end
end
@@ -22,8 +22,8 @@ class HomeControllerTest < ActionController::TestCase
should assign_to(:updated)

should "display counts" do
assert_contain "1,337"
assert_contain "1,000,000"
assert page.has_content?("1,337")
assert page.has_content?("1,000,000")
end

should "load up the total count, latest, and most downloaded gems" do
@@ -19,7 +19,7 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to :rubygem
should "renders owner gems overview links" do
@owners.each do |owner|
assert_have_selector "a[href='#{profile_path(owner.display_id)}']"
assert page.has_selector?("a[href='#{profile_path(owner.display_id)}']")
end
end
end
@@ -34,7 +34,7 @@ class RubygemsControllerTest < ActionController::TestCase
should render_template :show
should assign_to :rubygem
should "not render edit link" do
assert_have_no_selector "a[href='#{edit_rubygem_path(@rubygem)}']"
assert ! page.has_selector?("a[href='#{edit_rubygem_path(@rubygem)}']")
end
end

@@ -48,7 +48,7 @@ class RubygemsControllerTest < ActionController::TestCase
should render_template :show
should assign_to :rubygem
should "render edit link" do
assert_have_selector "a[href='#{edit_rubygem_path(@rubygem)}']"
assert page.has_selector?("a[href='#{edit_rubygem_path(@rubygem)}']")
end
end

@@ -63,10 +63,10 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to(:rubygem) { @rubygem }
should respond_with :success
should "have an invisible subscribe link" do
assert_have_selector "a[style='display:none']", :content => 'Subscribe'
assert page.has_selector?("a[style='display:none']", :content => 'Subscribe')
end
should "have a visible unsubscribe link" do
assert_have_selector "a[style='display:inline-block']", :content => 'Unsubscribe'
assert page.has_selector?("a[style='display:inline-block']", :content => 'Unsubscribe')
end
end

@@ -80,10 +80,10 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to(:rubygem) { @rubygem }
should respond_with :success
should "have a visible subscribe link" do
assert_have_selector "a[style='display:inline-block']", :content => 'Subscribe'
assert page.has_selector?("a[style='display:inline-block']", :content => 'Subscribe')
end
should "have an invisible unsubscribe link" do
assert_have_selector "a[style='display:none']", :content => 'Unsubscribe'
assert page.has_selector?("a[style='display:none']", :content => 'Unsubscribe')
end
end

@@ -97,13 +97,13 @@ class RubygemsControllerTest < ActionController::TestCase
should render_template :edit
should assign_to :rubygem
should "render form" do
assert_have_selector "form"
assert_have_selector "input#linkset_code"
assert_have_selector "input#linkset_docs"
assert_have_selector "input#linkset_wiki"
assert_have_selector "input#linkset_mail"
assert_have_selector "input#linkset_bugs"
assert_have_selector "input[type='submit']"
assert page.has_selector?("form")
assert page.has_selector?("input#linkset_code")
assert page.has_selector?("input#linkset_docs")
assert page.has_selector?("input#linkset_wiki")
assert page.has_selector?("input#linkset_mail")
assert page.has_selector?("input#linkset_bugs")
assert page.has_selector?("input[type='submit']")
end
end

@@ -147,7 +147,7 @@ class RubygemsControllerTest < ActionController::TestCase
assert_not_equal @url, Rubygem.last.linkset.code
end
should "render error messages" do
assert_contain /error(s)? prohibited/m
assert page.has_content?("error prohibited")
end
end
end
@@ -168,12 +168,12 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to(:gems) { @gems }
should "render links" do
@gems.each do |g|
assert_contain g.name
assert_have_selector "a[href='#{rubygem_path(g)}']"
assert page.has_content?(g.name)
assert page.has_selector?("a[href='#{rubygem_path(g)}']")
end
end
should "display uppercase A" do
assert_contain "starting with A"
assert page.has_content?("starting with A")
end
end

@@ -221,11 +221,11 @@ class RubygemsControllerTest < ActionController::TestCase
should render_template :index
should assign_to(:gems) { [@zgem] }
should "render links" do
assert_contain @zgem.name
assert_have_selector "a[href='#{rubygem_path(@zgem)}']"
assert page.has_content?(@zgem.name)
assert page.has_selector?("a[href='#{rubygem_path(@zgem)}']")
end
should "display uppercase letter" do
assert_contain "starting with Z"
assert page.has_content?("starting with Z")
end
end

@@ -245,14 +245,14 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to(:gems) { @gems }
should "render links" do
@gems.each do |g|
assert_contain g.name
assert_have_selector "a[href='#{rubygem_path(g)}']"
assert page.has_content?(g.name)
assert page.has_selector?("a[href='#{rubygem_path(g)}']")
end
end
should "display uppercase A" do
assert_contain "starting with A"
assert_not_contain "asdf"
assert_not_contain "ASDF"
assert page.has_content?("starting with A")
assert ! page.has_content?("asdf")
assert ! page.has_content?("ASDF")
end
end

@@ -268,10 +268,10 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to :rubygem
should assign_to(:latest_version) { @latest_version }
should "render info about the gem" do
assert_contain @rubygem.name
assert_contain @latest_version.number
assert_contain @latest_version.built_at.to_date.to_formatted_s(:long)
assert_contain "Links"
assert page.has_content?(@rubygem.name)
assert page.has_content?(@latest_version.number)
assert page.has_content?(@latest_version.built_at.to_date.to_formatted_s(:long))
assert page.has_content?("Links")
end
end

@@ -287,13 +287,13 @@ class RubygemsControllerTest < ActionController::TestCase
should render_template :show
should assign_to :rubygem
should "render info about the gem" do
assert_contain @rubygem.name
assert_contain @latest_version.number
assert_contain @latest_version.built_at.to_date.to_formatted_s(:long)
assert page.has_content?(@rubygem.name)
assert page.has_content?(@latest_version.number)
assert page.has_content?(@latest_version.built_at.to_date.to_formatted_s(:long))

assert_contain "Versions"
assert_contain @rubygem.versions.last.number
assert_contain @rubygem.versions.last.built_at.to_date.to_formatted_s(:long)
assert page.has_content?("Versions")
assert page.has_content?(@rubygem.versions.last.number)
assert page.has_content?(@rubygem.versions.last.built_at.to_date.to_formatted_s(:long))
end
end

@@ -306,7 +306,7 @@ class RubygemsControllerTest < ActionController::TestCase
should render_template :show
should assign_to :rubygem
should "render info about the gem" do
assert_contain "This gem is not currently hosted on Gemcutter."
assert page.has_content?("This gem is not currently hosted on Gemcutter.")
end
end

@@ -324,8 +324,8 @@ class RubygemsControllerTest < ActionController::TestCase
should render_template :show
should assign_to(:latest_version) { @version }
should "show runtime dependencies and development dependencies" do
assert_contain @runtime.rubygem.name
assert_contain @development.rubygem.name
assert page.has_content?(@runtime.rubygem.name)
assert page.has_content?(@development.rubygem.name)
end
end

@@ -348,10 +348,10 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to(:rubygem) { @rubygem }
should respond_with :success
should "have an subscribe link that goes to the sign in page" do
assert_have_selector "a[href='#{sign_in_path}']"
assert page.has_selector?("a[href='#{sign_in_path}']")
end
should "not have an unsubscribe link" do
assert_have_no_selector "a#unsubscribe"
assert ! page.has_selector?("a#unsubscribe")
end
end

Oops, something went wrong.

0 comments on commit 1a6a38c

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.