Created
January 28, 2009 21:13
-
-
Save neerajsingh0101/54190 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
module Test # :nodoc: all | |
module Unit | |
class TestCase | |
def self.should_assign_to_value(name,value) | |
should "assign @#{name}" do | |
assert assigns(name.to_sym), "The action isn't assigning to @#{name}" | |
if value =~ /#\{/ | |
tmp = '"' + value + '"' | |
assert_equal assigns(name.to_sym),eval(tmp,binding) | |
else | |
assert_equal assigns(name.to_sym),value | |
end | |
end | |
end | |
def self.should_redirect_to(url) | |
should "redirect to #{url.inspect}" do | |
instantiate_variables_from_assigns do | |
if url =~ /#\{/ | |
tmp = '"' + url + '"' | |
assert_redirected_to eval(tmp, self.send(:binding), __FILE__, __LINE__) | |
else | |
assert_redirected_to eval(url, self.send(:binding), __FILE__, __LINE__) | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment