I installed the current RSpec 2 Beta under Rails 3 RC as mentioned on the GitHub page (and several blogs). Everything works fine, but I am not able to turn off specific generators like advised on some blogs.
Here is what I do in ./config/application.rb:
config.generators do |g|
g.test_framework :rspec, :fixtures => false, :views => f...
I've got two files in app/views/users
-rw-r--r-- 1 create.html.erb
-rw-r--r--@ 1 new.html.erb
With autospec running and all my tests passing, I touch 'new.html.erb' and and growl notifies my that my tests can't run and autospec outputs:
0 examples, 0 failures
If I start autospec again all my tests pass.
If I touch 'create.html.erb...
My Rails 2 app displays a slideshow of photos from Flickr via the flickraw library. My code works, but I'm stuck on how to properly write RSpec unit tests.
I have a Slide class that encapsulates everything that my app needs from flickraw. It acts somewhat like a model object but doesn't use ActiveRecord. It doesn't do much work; it de...
Guys,
I need to test the following helper:
def display_all_courses
@courses = Course.all
output = ""
for course in @courses do
output << content_tag(:li, :id => course.title.gsub(" ", "-").downcase.strip) do
concat content_tag(:h1, course.title)
concat link_to("Edit", edit_course_path(course))
end
end
...
I am new on Ruby on Rails testing. I have seen many testing tools, such as Rspec,Cucumber,Seleneium,Watier etc.
but could not detail information about that.
Please give me a link for this.
...
So I just started using Steak, which in turn uses Capybara, which in turn uses Selenium.
So I've heard it's good RSpec practice to split testing into lots of little it-clauses, each testing a small piece of functionality. But then it makes a test run take a lot longer, because the same steps get repeated for each test.
Say I'm testing...
I'm getting an argument error whenever I run an RSpec test on any controller action that uses a POST or PUT action. It's happening on all of the controllers, no matter what I do. It's just the "wrong number of arguments (1 for 0)" one.
The app is working, but the tests are all failing. I think this is happening whenever a "save" is call...
I'm working with Time in Rails and using the following code to set up the start date and end date of a project:
start_date ||= Time.now
end_date = start_date + goal_months.months
I then clone the object and I'm writing rspec tests to confirm that the attributes match in the copy. The end dates match:
original[end_date]: 2011-08-24 ...
Hello,
I have a rails project which I am testing with rspec using script/autospec and it has been working great. However, I am now trying to add specs for a Vendor module in spec/lib/vendor/*_spec.rb and autospec ignores the files.
I have tried adding the following to .autotest based on the answer provided here with no success:
Autote...
Hi there,
i am trying to write a view_spec for my login form that uses authlogic. This is my current view_spec:
require 'spec_helper'
describe "user_sessions/new.html.haml" do
before :each do
user_session = mock("UserSession").as_null_object
assign(:user_session, user_session)
end
it "should have a login form" do
re...
Please bear with me as I'm a bit new to rails (especially rails 3), and I'm kinda stumped by this. Basically I want to test my CustomersController in my application using RSpec. When I execute my specs trying to perform a post to the create action in my controller, I get this error, and I'm not sure why:
1) CustomersController as gues...
I'm trying to test a rails action that takes raw json in the POST body. If i curl with the Content-Type: application/json header set, rails parses the params correctly.
How do you set the request body and headers directly in an rspec controller test?
...
I am trying to verify if a text have been written to file (build.log) after executing a rake task which will throw an exception. Checkout both the code snippets below, the one with begin works whereas lambda throws a message saying it couldn't find the build.log file.
Using begin to test.(works)
begin
Rake::Task['git:checkout'...
Hey,
I'm using Rails 3 rc, Factory Girl, and Rspec, and Authlogic.
Is there any way or reason why this would happen:
When I create a user like this:
@user = Factory(:user)
I get an issue with password confirmation being "too short".
my factories.rb is
Factory.define :user do |u|
u.username "Test User"
u.email "...
Hello all,
I'm very new to rails and I've been following a lot of great tutorials and examples out there in the community, so first off thank you!
I'm having a problem with my test code. The application works, and I can see from tailing the test logs that the database is being written, but for some reason, it's not returning the save ...
NetBeans 6.9 provides a custom Runner class for RSpec to be integrated into the IDE. I'm trying to get my Rails 3 applications specs to be correctly displayed inside NetBeans, but RSpec 2 seems no longer to support custom Runner classes in general.
Any ideas how to get the specs into the IDE anyway?
...
I'm implementing a service that has several different ways it can be accessed:
Using simple query parameters
With parameters encoded as a Javascript object
For some calls both GET and POST are supported, with POST being used when there is large amounts of data being sent to the service.
What's the best way to structure my RSpec test...
Using tspec 2 I want to create a rake task on the fly to be run, we used to do the following in RSpec 1:
Spec::Rake::SpecTask.new(:client) do |t|
t.spec_files = FileList['spec/units/client/**/*_spec.rb']
t.spec_opts = spec_opts
end
But now Spec::Rake::SpecTask was substituted, any suggestions?
Regards
...
I've been trying to stub open, the open-uri version, and I'm not succeeding.
I've tried doing the following but the request keeps going through:
Kernel.should_receive(:open).and_return("Whatever for now")
I've also tried to do
OpenURI::OpenRead.should_receive(:open).and_return("Whatever for now")
Since I tracked down that was wher...
I have some nested models that require a bit more than the standard accepts_nested_attributes_for logic. Instead of automatically creating or updating child records based on id key, in this case the child records must already exist and have certain other conditions, or it raises an error.
So as part of this, I have a parent model itera...