Displaying 20 results from an estimated 300 matches similar to: "What do you think of this controller spec?"
2007 Oct 11
2
Login testing ideas
I''ve been going through Pat''s example story and noticed that there was
no checking for a bad login. I assume this is because that would have
made the article bigger and more complicated than it needed to be.
So the question that comes of of this is:
How do folks normally handle the negative case? My plan was to just
use another scenario, but as a new person to BDD/TDD,
2007 Nov 13
2
More Rails Pattern Examples?
Hi,
I have been reading the documentation and examples on the rspec site.
There are two "patterns" from Rails that I am not clear how to
implement that are kind of related, and so I am not sure how to start.
Does anyone have any examples of how to write rspecs for these?
1/ Nested resources.
2/ Resources that are specific to the current_user. In other words, I
only want to
2007 Nov 21
6
How thorough do you test?
Testing models is great and would not be able to create anything without
it, but I am finding testing the controllers and views is a pain.
Rest based controllers don''t seem to change that much when compared to
the auto-generated code that obviously works.
As for views I fail to see why testing it with a mock model does
anything. Nothing is ensuring that when changes are made to the
2007 Sep 07
12
Preconditions
Sorry, lots of questions these days.
Is there a normal approach for preconditions? In JUnit, I might put a few
assertions in the setUp() just to make sure that the test ''data'' I''ve
created meets expectations before going to test it.
So, for instance, I''ve got an object that is audited using acts_as_audited
and I''d like to test the XML that results
2007 Sep 30
9
Problems with testing nested routes using mocking
Hello forum
I have there to files
#----- virtual_host_controller.rb
class VirtualHostsController < ApplicationController
before_filter :capture_domain
# GET /domain/1/virtual_hosts/1
def show
@virtual_host = @domain.virtual_hosts.find(params[:id])
respond_to do |format|
format.html # show.rhtml
end
end
private
def capture_domain
if
2007 Apr 09
7
RCov results seem to include the spec files
I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and
decided to add it to my project. My rakefile looks like this:
require "rake"
require "spec/rake/spectask"
desc "Run all specs with RCov"
Spec::Rake::SpecTask.new("spec:rcov") do |t|
t.spec_files = FileList["spec/**/*_spec.rb"]
t.rcov = true
end
When I run rake spec:rcov,
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)
2008 Jan 21
9
DRY act_as_authenticated functional testing
I''m using the acts_as_authenticated plug-in for my app. Now I need to
get my functional tests to work properly. I have not written functional
tests before so I''m unsure how to utilize setup so that all of my tests
can use the login. My tests pass if I put login_as :user inside of each
test, but that''s clearly not DRY. Can I add something to my
test_helper.rb file or
2007 Nov 04
3
Returning the mock associated with an expectation.
I was reading through the FlexMock docs and noticed the expectation
method .mock, which returns the original mock associated with an
expectation.
It looks really handy for writing nice all-in-one mocks like:
mock_user = mock(''User'').expects(:first_name).returns(''Jonah'').mock
So I started playing around with mocha and found I could actually
already do this!
2008 Mar 08
7
ridding away with do_request
I''m heading out of town, but had a quick thought I wanted to share.
Rather then using ambiguous named request helpers in controller specs
like "do_request", I''ve been using more readable helpers like
"post_create".
For example...
describe ProjectController do
def post_create
post :create, ...
end
before do
end
it "creates a new
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 Sep 13
5
Authenticating before tests
Hi all,
I''m using Goldberg, an engine that provides roles based access
control for my app. I need to login before I can do controller tests,
but I can''t find any examples of people doing this.
Could someone point me in the right direction?
I thought the simplest way would be to either call the login action
from my other tests before(:all), but I can''t seem to
2015 Sep 25
3
FreeBSD backed with a PR1500LCDRT2U
>
>> usbconfig -u 4 -a 2 dump_curr_config_desc
>
> Here is output of the command. Thank you for your help with this.
>
> ugen4.2: <product 0x0601 CyberPower Systems> at usbus4, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (50mA)
>
[...]
> bLength = 0x09
> bDescriptorType = 0x21
> bDescriptorSubType = 0x10
>> RAW dump:
>> 0x00 | 0x09, 0x21,
2007 Jun 25
1
Functional tests and active scaffold: unexpected assertion failure.
Hello,
I''m writing a functional test for a controller that uses active
scaffold.
def test_presence_of_field
login_as(:peter)
profile = Profile.find :first
get :edit, {:id => profile.id}
assert_response 200
assert_select "textarea#record_free_text_ec"
end
I was expecting the first ''assert 200'' to give me a green bar,
but added it for
2015 Sep 24
2
FreeBSD backed with a PR1500LCDRT2U
>>
>> The output was also not as big as you made it out to be.
>
> Well, I didn't expect the driver to fail *that* badly :-)
>
> Assuming the UPS is still at /dev/ugen4.2, can you try the following command? (Probably needs to be run as root, with the driver stopped.)
>
> usbconfig -u 4 -a 2 dump_curr_config_desc
Here is output of the command. Thank you for
2019 Oct 10
1
[PATCH NOT WORKING nbdkit] vddk: Restructure plugin to allow greater parallelism.
We had a query yesterday about the VDDK plugin and making it actually
obey the weird "Multithreading Considerations" rules in the VDDK
documentation
(https://vdc-download.vmware.com/vmwb-repository/dcr-public/8f96698a-0e7b-4d67-bb6c-d18a1d101540/ef536a47-27cd-481a-90ef-76b38e75353c/vsphere-vddk-671-programming-guide.pdf)
This patch is my attempt to implement this.
The idea is that the
2007 Sep 04
3
Model Specs: Fixtures vs Mocks + Stubs?
What is the general opinion about fixtures versus mocking and stubbing
in model specs? I heard from agile on IRC that they save the database
testing for integration testing, but I also see that the caboose
sample applicaiton uses fixtures. I also noticed that on the rspec
site, it says "Ironically (for the traditional TDD''er) these are the
only specs that we feel should actually
2007 Apr 11
13
View Specs Fail with "protected method render"
I''ve got rspec and zentest installed as well as the rspec rails plugin, and
my model/controller specs all pass and work well. I can''t seem to get views
to work though - 100% of the specs fail with:
NoMethodError in ''/users/show.rhtml should render attributes in <p>''
protected method `render'' called for
2008 Mar 20
5
sharing story steps
Hi,
How can I have a common set of steps that all my stories share?
i.e. My stories often start out looking like this:
Given a user Joe
Given a user Jordan
then:
Given("a user $username") do |username|
@users ||= {}
@user_sessions ||= {}
@users[username] = create_user(:username => username)
@user_sessions[username] = login_as(@users[username])
end
I want to share that
2015 Aug 18
2
Need help with Tripp Lite SMART1300LCDT NUT v2.7.3
Here are all the usbconfig outputs you have requested.
I have left a message with the Dev for NAS4Free to give up the ./configure for NUT portion.? I am hoping they will...
usbconfig -u 0 -a 5 dump_device_desc?
datanas: ~# usbconfig -u 0 -a 5 dump_device_desc
ugen0.5: <TRIPP LITE UPS Tripp Lite> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)? bLength = 0x0012
? bDescriptorType =