similar to: Acts as Authenticated

Displaying 20 results from an estimated 5000 matches similar to: "Acts as Authenticated"

2007 Aug 14
4
Stubbing all methods
Mocha''s mock/stub framework has the ability to stub all methods on a mock given. Does RSpec''s mocking framework have this ability? And if not, is there some reason it shouldn''t be implemeneted? Regards, Scott
2007 Aug 11
2
Rspec and acl_system2 plugin
Hello, I''m trying to spec a Rails application using the couple restful_authentication/acl_system2 plugins. In my admin layout, I put the following code : <% restrict_to "admin" do -%> <ul id="admin-tabs"> <li> /users Users management </li> </ul> <% end -%> Then in my spec file
2007 Jun 18
7
Testing for cross site scripting, etc.
Being new to testing and ruby, are there "standard" tests that can be done that test for things like cross site scripting and friends? If not, anyone have ideas on what I might do about testing those sorts of things? I''ll be using rails, also. Mike B. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging
2007 Jul 12
3
Agh, this is annoying. Why is this happening?
My problem: Mock ''Task_1005'' received unexpected message :user_id= with (1) No matter what I do to try to stub that out it will still fail out and give me that message. Here is my spec describe TasksController, "handling POST /tasks" do before(:each) do @task = mock_model(Task, :to_param => "1", :save => true)
2007 Jul 31
9
Any liberally-licensed open source projects out there that make good use of RSpec?
I''m trolling for example RSpec code. Any pointers appreciated. Cheers, Obie
2007 Aug 21
2
using restful_authentication current_user inside controller specs
I''m using restful_authentication in my app and I have the before filters in my application rhtml: before_filter :login_required around_filter :set_timezone around_filter :catch_errors Currently I have them commented out while rspec''in but I''ll need to add them in my specs. def create @ticket = Ticket.new(params[:ticket]) @ticket.user = current_user if
2006 Oct 04
3
do we need stubbing?
Hey all - The trunk currently supports three types of mocking/stubbing: Mock Objects (created dynamically at runtime) Partial Mocking of methods on existing classes Stubbing of methods on existing objects or classes The main difference between Partial Mocking and Stubbing is that Stubs don''t verify. I''m wondering if we really need the stubbing facility at all, given that we
2007 Feb 13
7
Specs of code that use Time.now
Hi Just trying to spec a Rails model that defaults a valid_until date to this time tomorrow. I''ve done something similar involving Dates, and you can stub the :today method to return something fixed. But when I tried this with Time, I found that RSpec calls Time.now four times per spec. So there''s no way to spec code like 1.days.from_now . The best I can come up
2007 May 26
11
RSpec
Hi RSpec Mailing list, I''m new to RSpec and I am trying to get it running with the caboo.se sample rails app. I installed the current version of rspec with rspec_on_rails I tried to run rake spec but received: 330-07:~/desktop/restful_auth_rspec/vendor multimedia$ rake spec (in /Users/multimedia/Desktop/restful_auth_rspec)
2009 May 04
6
cucumber - when to stub/mock
I''m just curious about this, since my solution involved stubbing a call to GeoIp. Is there a good rule of thumb for when you make exceptions to the ''no stubbing'' philosophy of Cucumber? My step was: "Given I am accessing the site from Japan," but I can think of other situations - mostly when interacting with web services, that I''d probably
2007 Feb 28
4
acts_as_authenticated error with Object#id
I''m getting this when I run my Rails controller specs. <projectroot>/config/../lib/authenticated_system.rb:16: warning: Object#id will be deprecated; use Object#object_id I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper method. Anyone know how to fix this? -- Cheers,
2007 Feb 07
5
Mocking ActiveResource
I want to use ActiveResource in my app. Instead of hitting server though, I want it to load from a file when I call find. Any clue how I do that? Pat
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall. Thanks to Wilson for converting to the new form. I''ve added a few lines. Basically, it iterates over your model associations and does two things. - First, just try to call the association. Usually fixes speeling erors or other such silliness. - Second, try to find a record with an :include on the association. This
2008 Jan 30
2
Stubbing controller methods vs model methods
I had an error that I couldn''t figure out, then when writing up a question for the forum I figured it out. The thing is I don''t understand why the change that was made works and why what existed before didn''t. Here is the initial post when I had the error: ---------------------------------- In the controllers/application.rb file I have a method that finds the account
2007 Apr 10
6
getting output of STDOUT in spec
Consider the following method: def name_to_terminal puts "Scott Taylor" end How would I spec this out? Scott
2007 Jun 03
3
should_receive.again
Hi, It appears that if I have 2 should_receives in a row, the latest one overrides the previous one(s). If there isn''t one, could we add a way to accumulate them, such as @thing.should_receive(:method).and_return(@value) @thing.should_receive(:method).again.and_return(@value) @thing.should_receive(:method).again.and_return(@value) would be equivalent to
2007 Jun 25
5
strange mock error
I''m testing using the rspec mocking framework and rspec 1.0.5 and I''m getting the following strange error: #<Spec::Mocks::Mock:0x337f7c8> expected :set_defaults with (#<Service: 0x19c4040 @name="Service_1023">, {"1"=>"1", "2"=>"2"}) but received it with (#<Service:0x19c4040
2007 Mar 27
3
Stubbing out method for all instances
I am using the acts_as_state_machine plugin to control state of an object in my app, however when testing this I need to be able to stub out the guard conditions so that state will change when I fire off an event without depending on other models. Guard conditions simply return true or false so I have an instance method: def encoded? <check state of other objects> return true
2007 Feb 23
4
How can I spec this? The method gets passed a block...
I''m using Jim Weirich''s Builder library. The code I want to spec is xml.video do xml.id @video_id xml.views @views xml.date(@date.to_s) if @date end I''d like to mock it, rather than asserting that the XML is the right string. I can do one spec: specify "should create a video tag" do @mock_builder.should_receive(:video)
2007 Feb 28
12
Specifying that code is called in a block
Not sure if this is possible currently. I have a section of code like this: ActiveRecord::Base.transaction do cow.save! duck.save! dog.save! end (Names changed to protect the innocent.) I''d like to specify that the saves run in a transaction. I can do ActiveRecord::Base.should_receive(:transaction).and_yield But is there any way to specify that the code is