Displaying 18 results from an estimated 18 matches for "assert_match".
2006 Mar 02
2
url_for_file_column not returning correct path
...he included
file_column_helper_test.rb that shipped with the file_column plugin:
def test_url_for_file_column_different_root_path
Entry.file_column :image, :root_path => File.join(RAILS_ROOT,
"public/files")
e = Entry.new(:image => upload(f("skanthak.png")))
assert_match %r{/public/files/entry/image}, e.image_options[:store_dir]
assert e.save
assert_match %r{files/entry/image}, url_for_file_column(e, "image")
end
the last assert_match did not pass...
1) Failure:
test_url_for_file_column_different_root_path(UrlForFileColumnTest)
[file_column_...
2006 May 04
6
second assert_tag failling in rails integration test
...')
end
end
3) create an integration test:
require "#{File.dirname(__FILE__)}/../test_helper"
class MyTest < ActionController::IntegrationTest
def test_one
post(''/test/one'')
assert_tag(:content => /one/)
post(''/test/two'')
assert_match(/two/, @response.body)
assert_tag(:content => /two/)
end
end
4) ran the integration test.
So, I expected the assertions to all pass, but instead I got the
following error:
Loaded suite test/integration/test_one
Started
F
Finished in 0.131389 seconds.
1) Failure:
test_one(MyTest)...
2008 Nov 05
2
Warning: Ambiguous first argument; make sure.
Hello,
I''m getting this warning:
Warning: Ambiguous first argument; make sure.
in my unit test:
assert_match /^[a-zA-Z0-9]+$/, user.username
Does anyone know why or how to change it so it disappears?
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk&q...
2007 Feb 04
10
Spec''ing ActionMailer
Good morning (Pacific Time). I have a controller action that, as a
side-effect, sends an email to an administrator. I want it to do
something like this:
specify "when someone successfully signs up, an email should be sent
to the administrator with the person''s contact page" do
post :signup, {...lots o'' params}
response should_be success
#
2006 Mar 25
0
in_place_collection_editor
...Class.new do
def url_for(options, *parameters_for_method_reference)
url = "http://www.example.com/"
@@ -91,4 +103,30 @@
:load_text_url => { :action => "action_to_get_value" })
end
+ def test_in_place_collection_editor_with_simple_array
+ assert_match "Ajax.InPlaceCollectionEditor(''id-goes-here'', ''http://www.example.com/action_to_set_value'', {collection:[''1'',''2'',''3'']})",
+ in_place_collection_editor(''id-goes-here'',
+ :url...
2006 Jul 19
1
Testing the flash is brittle?
Hello all,
I seem to have an annoying habit of realizing that I''ve asked a
question with a blindingly obvious answer just after I''ve asked it
but here goes.
I''ve noticed that in my functional tests there''s the occasional
reliance on the contents of the flash. For example, I have an action
that confirms a users identity and may reject them because
A)
2006 Feb 03
2
testing to see if emails are sent out on exceptions
Hi,
I''m using ActionController::rescue_action_in_public() to send emails
when uncaught exceptions happen.
Is it possible to write tests for that?
Joe
2012 May 13
1
is assert_select_rjs deprecated in Rails 3.1 ?
...in 3.0.9 doc (
http://apidock.com/rails/v3.0.9/ActionDispatch/Assertions/SelectorAssertions/assert_select_rjs
)
but it''s not mentioned in the latest guide (
http://guides.rubyonrails.org/testing.html#integration-testing-examples)
if deprecated how can I check the view from an Ajax call
( assert_match + gsub could work ? ... )
am I missing any doc ?
xhr :get, :change_area, { :area => south_west.id}
thanks for feedback
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JY...
2008 Mar 12
2
Whence "post" in a description?
I''m having the exact problem described in this earlier post:
http://www.nabble.com/Odd-response.body-behavior-to12837556.html#a12837556
That is, after a post, response.body is just the controller/view string
("user/login" in my case).
Failing to find any answer on the web, I''m trying to trace execution, but
hitting a bit of a snag. I''m tracing the ancestry
2010 Oct 14
1
Cucumber Selenium web step to verify value of input field
..."([^\"]*)"$/ do |field, selector, value|
with_scope(selector) do
field = find_field(field)
field_value = (field.tag_name == ''textarea'') ? field.text : field.value
if field_value.respond_to? :should
field_value.should =~ /#{value}/
else
assert_match(/#{value}/, field_value)
end
end
end
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, se...
2013 Nov 05
4
Handling closed clients
...t_server.rb
+++ b/test/unit/test_server.rb
@@ -145,8 +145,7 @@ class WebServerTest < Test::Unit::TestCase
# processing on us even during app dispatch
sock.shutdown(Socket::SHUT_WR)
IO.select([sock], nil, nil, 60) or raise "Timed out"
- buf = sock.read
- assert_equal "", buf
+ assert_match %r{\AHTTP/1.[01] 500\b}, sock.sysread(4096)
next_client = Net::HTTP.get(URI.parse("http://127.0.0.1:#@port/"))
assert_equal ''hello!\n'', next_client
lines = File.readlines("test_stderr.#$$.log")
@@ -265,4 +264,55 @@ class WebServerTest < Test::Unit::TestCase...
2006 Jan 17
0
file_column with both root_path and store_dir
...file_column_db", :store_dir => store_dir_method}
e = Entry.new
e.image = uploaded_file(file_path("kerb.jpg"), "image/jpeg",
"kerb.jpg")
assert File.exists?(e.image)
assert e.image !~ /\.\./, "#{e.image} is not a simple path"
assert_match %r{/u/file_column_db/somebodys_account/images},
e.image
end
def store_dir_method
File.join("somebodys_account", "images")
end
This fails with:
1) Failure:
test_absolute_path_outside_rails_root(ResourceTest) [test/unit/
resource_test.rb:254]:
<"/usr/h...
2005 May 30
2
Testing action mailer in functional tests - missing section in the book
Hi !
I just need a pointer on how to do functional testing of ActionMailer.
My unit test for the ActionMailer is working fine - now I simply need to
assert that it''s being called in my Controller.
The testing book ends quite abruptly at
http://manuals.rubyonrails.com/read/chapter/64
I searched around on the web, but I didn''t find anything very conclusive.
Thanks,
François
2007 Jun 21
3
With Parameter Block
...tests, I''ll take the
approach of putting test assertions inside the parameter block, and
always returning true.
This is a contrived example:
def test_something
mock = mock("some_mock")
mock.expects(:foo).with do | param_that_is_a_string,
param_that_is_a_model |
assert_match(/something-for1/, param_that_is_a_string)
assert param_that_is_a_model.valid?
true
end.returns("blah")
end
Again, I''m not against code readability, but I do prefer to be able
to write my tests explicitly instead of creating a matcher for each
special case.
-Zac...
2006 Mar 02
17
can''t get rails to connect to mySQL - HELP!!!!!!!!!
Sorry, but this is really NOT as easy as the tutorials/books make out.
I''m really struggling at the first hurdle here. And while I''m not a
programmer by design I do know my way around most stuff. And if I can''t
get this to work I suspect more people will have the same issues. There
seems to be too many variables to address.
I have winXP, I have ruby and rails all
2009 Feb 19
8
validate for street
Hallo all,
can someone tell me what can be the regulare expression for this:
"The Road", "The Road 12", "Road", "On the Road 89".
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
2007 Feb 16
13
negate the regexp in validates_format_of
Railsters:
ActiveRecord''s validation system puts other database systems to shame.
However, the newbies might not know how to write a regexp that
excludes a match, instead of tests for it. Understand - I''m just
asking this question to help them. I have been using Regexps since
''grep'' on Xenix! But the newbies here might not know how to do this:
2006 Nov 26
0
[758] trunk/wxruby2: i18n support: added Locale class, methods for get/set languages & encodings
...t::Unit::UI::Console::TestRunner.run(self.test_class)
+ end
+end
+
+class TestInternationalisation < Test::Unit::TestCase
+ def test_encodings
+ default = Wx::Font.get_default_encoding
+ assert_kind_of(Integer, default)
+ assert_kind_of(String, Wx::Font.get_default_encoding_name)
+ assert_match(/\A[-A-Z0-9]+\z/, Wx::Font.get_default_encoding_name)
+
+ Wx::Font.set_default_encoding(Wx::FONTENCODING_UTF8)
+ assert_equal(Wx::FONTENCODING_UTF8, Wx::Font.get_default_encoding)
+ assert_equal(''UTF8'', Wx::Font.get_default_encoding_name)
+
+ Wx::Font.set_default_encod...