similar to: Using a method from another class

Displaying 20 results from an estimated 100000 matches similar to: "Using a method from another class"

2009 Apr 06
3
After Rails 2.3.2 upgrade: superclass mismatch for class TestCase (TypeError)
I upgraded a working app from rails 2.1 to 2.3.2. Now when I run rake test:units I get this error: /usr/lib/ruby/gems/1.8/gems/ activesupport-2.3.2/lib/active_support/test_case.rb:17: superclass mismatch for class TestCase (TypeError) I generated a new test app and all tests run OK. For the upgrade I ran rake:update and renamed the class in test_helper to ActiveSupport::TestCase. Also renamed
2008 Feb 08
0
Challenge! How can I write a test to test the methods in ApplicationController?
Hi all, I''ve been Googling this one for a while now, and haven''t found a satisfactory answer. It has been posted here before by someone else, but it seems to have got forgotten, so here goes - perhaps someone can think up a way around the problem? In ApplicationController, I have the following method: class ApplicationController < ActionController::Base <snip>
2009 Jun 16
1
[PATCH server] Fix errors in controller tests.
A bunch of controllers were not extending ActionController::TestCase, and instead were just using the basic test/unit testcase, so we were not getting some of the rails baked-in stuff. Signed-off-by: Jason Guiditta <jguiditt at redhat.com> --- src/test/functional/host_controller_test.rb | 2 +- src/test/functional/nic_controller_test.rb | 2 +-
2016 Jun 07
0
[PATCH 2/2] ruby: tests: Give each test class and method a unique name.
'tc_410_close_event.rb' was not being run. You could prove this by simply inserting "exit 1" into that test. The reason is unclear, but by renaming every class and method in the tests to be unique, this ensures the tests are run. --- ruby/t/tc_010_load.rb | 4 ++-- ruby/t/tc_020_create.rb | 4 ++-- ruby/t/tc_030_create_flags.rb | 4 ++--
2006 Feb 07
0
scope problems testing a helper method that calls link_to()
We''ve been having problems writing functional tests for helper methods that rely on ActionView methods. Here''s a specific example. In application_helper.rb I''ve got a method called ''party_link()ยจ: def party_link(party) link_to party.full_name, { :controller => ''contacts'', :action =>
2009 Apr 24
4
Undefined method "redirect_to" in before_filter
Code sample: class SomeController < ApplicationController before_filter do |c| add_crumb "Blah", "/blah" #breadcrumbs plugin redirect_to :controller => "foo", :action => "bar" unless c.send (:has_package?) end # Rest of the controller... private def has_package? # A bunch of logic work to check to make sure # somebody''s session contains
2010 Jul 11
4
Testomg: doing def test_blah or test "blah" do
Hey, I''m wondering about the distinction between writing test methods like 1. def test_something_to_test end and like 2. test "something to test" do end It seems like there''s no difference. I did notice, however, that #2 can''t be done in a class that extends Test::Unit::TestCase, while it can be done in one that extends ActionController::TestCase. I also
2010 Aug 29
0
Troll - A Rails plugin for making webservice mocking easier
Hi Folks, Troll trumps your existing ActiveResource mocking libraries like inbuilt HttpMock,Fakeweb or Webmock out of water. With Troll, ActiveResource mocking just works, some of its features: 1. Don''t need to mock calls at Net::HTTP level (which webmock,fakeweb do). Really, we don''t care what HTTP library ActiveResource uses, fakeweb and webmock bring additional complexity
2005 Mar 09
9
Unit testing + instance variables
After *much* digging and playing around, I finally figured out how to unit test instance variables that are created by actions. It was more difficult than I expected. It seems like there should have been a more straight forward way to do this. Can someone enlighten me? A simplified and somewhat contrived example of what I am current doing: Thanks. Matt >> # My Controller of interest
2009 Apr 07
3
assert_valid in unit tests after upgrade to rails 2.3 doesn't work
def test_valid assert_valid State.first end Error: test_valid(StateTest): NoMethodError: undefined method `assert_valid'' for #<StateTest: 0x7f0d60750318> I see that test_valid is now in ActionController::Assertions::ModelAssertions. Does this mean that test_valid is designed to be used i ActionController tests only? I can change my assert_valid(State.first) into assert
2009 Apr 06
9
setup method in functional tests and instance variables
I have the following in my functional test file. class UserControllerTest < ActionController::TestCase fixtures :users def setup @controller = UserController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @invalid_user = user(:invalid_user) @valid_user = users(:valid_user) end def test_login_success
2008 Mar 01
0
Fixtures in ActionController::TestCase
Hi guys, Need some help. I am using Rails 2.0 and while writing functional test, I encountered the following problem class UserControllerTest < ActionController::TestCase fixtures :users ... def do_something attempt_login(users(:valid_user)) # assuming valid_user is a proper line in ... end def attempt_login(user) post :login, :user => { :login => user.login, :password
2006 Jun 28
0
ActiveResource (was: 1.1.3 available.)
2006/6/28, Paul Barry <mail@paulbarry.com>: > Where can I find info about the "CRUD/resource-based features" that will be > in 1.2.0? In blogs. Especially about Railsconf and DHH''s keynotes. In trunk : http://dev.rubyonrails.org/browser/trunk/activeresource In DHH slides : Transcription of some slides from DHH''s talk at RubyKaigi 2006 (I suppose it must
2008 Jan 12
0
Can't test application controller methods in functional tests?
I have two methods in application controller that I want to test from ForumController: ----------------------- class ApplicationController < ActionController::Base ... def logout session[:username] = nil session[:admin] = nil redirect_to(request.request_uri) end ... def home redirect_to(:controller => ''forum'', :action =>
2009 May 18
0
[PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.
Signed-off-by: Scott Seago <sseago at redhat.com> --- src/test/functional/host_controller_test.rb | 41 -------------------- .../functional/managed_node_configuration_test.rb | 14 ++++--- src/test/functional/nic_controller_test.rb | 8 ---- src/test/functional/permission_controller_test.rb | 15 ++++--- src/test/functional/quota_controller_test.rb | 2 +-
2007 Jan 17
8
Mocha Mock''s hanging on after test run?
Hi guys, I''m running mocha (0.3.2) against Rails core and just found an issue where the mock doesn''t go away after the test is run. For example: def test_reset_bang_doesn_reinstall_named_routes ActionController::Routing::Routes.named_routes.expects(:install).never @session.reset! end def test_zzz puts ActionController::Routing::Routes.named_routes.inspect
2008 Mar 16
3
undefined method `redirect_to'
Hi all. I''m getting the following error in my app: undefined method `redirect_to'' for ActionController::Base:Class I''m using Windows 2000, Rails 2.0.2 and resource_controller (from James Golick). My controller: class CommentsController < ApplicationController include ResourceController::Controller belongs_to :post, :article, :photo create do
2009 Jul 01
1
[PATCH server] fixed expected status messages that were failing unit/functional tests.
--- .../functional/cloud/instance_controller_test.rb | 2 +- src/test/unit/vm_service_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/functional/cloud/instance_controller_test.rb b/src/test/functional/cloud/instance_controller_test.rb index 71d132b..0d713d4 100644 --- a/src/test/functional/cloud/instance_controller_test.rb +++
2008 Jun 12
1
Which "get" is being used in Controller spec
Hi, I''m a bit puzzled with "get" in controller specs. When I write, it "should render index template" do get :index response.should render_template(:index) end Which "get" method is being used? I checked RDoc of RSpec and RSpec on Rails, but didn''t find "get". In Rails RDoc, I found the following "get"s. get
2012 Feb 04
0
Interoperating ActiveResource and ActionController::Responder
I''ve just created a pull request to finally make ActiveResource correctly handle validation errors returned from ActionController::Responder''s default JSON handling code. The code also handles the format produced by pre-3.2 Responders *and* the format previously expected by ActiveResource, so it shouldn''t break in any application that was working before.