Created
December 12, 2008 18:04
-
-
Save lmarburger/35209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
require 'flexmock/test_unit' | |
class SomeControllerTest < ActionController::TestCase | |
context "viewing the test page" do | |
setup do | |
get :index | |
end | |
should_respond_with :success | |
should_render_template 'index' | |
should_assign_to :some_var, :equals => 'something' | |
should_include_javascript 'blah' | |
should_set_body_class :store | |
should "show navigation" do | |
assert_select 'ul#nav', 1 | |
end | |
should "show sub navigation" do | |
assert_select 'ul#menu', 1 | |
end | |
should "show some address element" do | |
assert_select 'div#address' | |
end | |
end | |
private | |
def self.should_include_javascript(source) | |
should "include javascript #{source.inspect}" do | |
assert_select "script[src^=/javascripts/#{source}.js]" | |
end | |
end | |
def self.should_set_body_class(*args) | |
args.each do |class_name| | |
should "set body class of #{class_name.inspect}" do | |
assert_select "body.#{class_name}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment