similar to: specs for RJS

Displaying 20 results from an estimated 4000 matches similar to: "specs for RJS"

2007 Jul 06
3
stubbing helper methods for View specs
Hi there I have several view specs, that include the following snippet in their "before" block to stub the methods by acts_as_authenticated before :each do @u = mock_model(User) @u.should_receive(:name).and_return("Hans Muster") template.should_receive(:logged_in?).and_return(true) template.should_receive(:current_user).and_return(@u) end this
2007 Jun 15
2
Is it still possible to use should_have_rjs
Hi I''ve come back to a Rails project after about a month doing other work, and there''s a lot of changes. I was on the 0.7 branch before and I''ve upgraded to RSpec 1.0.5. I used the spec translator, fixed the cases where it barfed on unusual line contents, and all my model and controller specs now pass. But I''m getting 53 failures on my view specs,
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
2007 May 03
1
unexpected failures with --reverse
I''m having trouble figuring out why one of my specs passes when run without --reverse and then fails with --reverse. What am I missing? I''m using the plugin versions of both rspec and rspec_on_rails 0.9.2. Here is the offending spec (Bill is an ActiveRecord model in a Rails app): ---------- describe Bill, " when valid" do def valid_bill_attributes { :uuid =>
2008 Dec 10
3
rspecing rjs - form.reset(''form'')
Hello, > > I couldn''t find much info on this. > > How do you rspec this: page.form.reset("form") > > I looked in the have_rjs source code and I can''t find anything on form > reset. > > Thanks, > > -- > Andrei > -------------- next part -------------- An HTML attachment was scrubbed... URL:
2007 Nov 01
2
Writing controller specs
One thing that is bothering me about my controller specs is that sometimes I end up with a number of examples that are the same except for the example name. The reason that this happens is that I''ve expressed all the expected behavior with should_receive. While this does more or less work as intended it doesn''t feel right. As an example, let''s say I''m writing
2007 Jun 15
6
problem getting started with stubbing in rails controller specs
Hello, Ingo! I''m copying your question to a new e-mail instead of replying to try to keep message threads separate. Have you tried setting up your expectation before issuing the get statement? For example, take this out of the setup block: get ''index'', :locale => ''en'' and move it after:
2007 Feb 05
1
long jumping out of code in specs
I wrote this abomination just now, and wonder if anyone else has had experience with the pattern behind it. In short, I''m specing an after_create hook on an ActiveRecord model, that calls a bunch of private methods. Instead of stubbing all those private methods (which is verboten anyway, as well as impossible because creating the object which owns those methods is what I''m
2007 Feb 13
1
RJS specs
Hi again... This is wierd spec problem no. 3. I''ve got a simple one line RJS file that renders a partial specified by the controller page.replace_html("product_info", :partial => @product_partial) The partials in question will contain purely static content - the idea is to have some dynamic links, so you hit http://localhost:3000/gap/product_info/product_1
2007 Jul 26
5
Coding standards and whitespace
Recently as a result of using Git I''ve noticed a number of inconsistencies in the RSpec codebase with respect to whitespace (mixed line endings, mixed use of spaces and tabs for indentation, and trailing whitespace at the end of lines). I never would have noticed, but Git produces nice colorized diff output which highlights these kinds of inconsistencies. I wanted to ask if the
2007 Feb 06
0
assert_select_rjs with on a page with "page.select" in it
I''m having a bunch of testing an RJS action. The action updates a DIV if it exists, but it isn''t always necessarily present on the page so I use a page.select in the RJS to check if it exists. (Is there a better way to do that?) Let''s say we have an RJS page containing: page.select("some_element_that_may_or_may_not_exist").each do |value|
2007 Oct 25
1
Mocking/Stubbing help with subdomain as account key
My app uses account_location to set up subdomains as account keys. In my controllers, all my model operations are scoped through the @current_person object. The question is: How do I test this with RSpec''s mocking and stubbing? Basically, I need to test that @current_person.things is getting the find message and returning @thing. I''ve tried stubbing and mocking
2007 Jun 09
11
authentication, controller specs. I think I''m missing something simple ....
Hi all, I feel like I''m missing something really easy and I''m just not seeing it. I''m using the restful_authentication plugin and have a User model. Uesr has_many :things and Thing belongs_to :user. That''s it. I did a "script/generate rspec_scaffold thing" to generate all the necessary bits. The "rake db:migrate" to create the db. At
2007 Oct 05
13
spec''ing view render partial collection, local variable not found
I''m trying to spec out a render partial collection but I get the following error 2) NoMethodError in ''/games/_game.rhtml should show game name'' undefined method `body'' for #<#<Class:0x316580c>:0x2f1154c> /Volumes/EXTERNAL/web/omenking.ca/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/have_text.rb:12:in `matches?''
2008 Mar 05
3
having trouble specing an ajax request
Do I need to spec an AR. If yes, what is the best way to spec this. here is the code - def index @deals = Deal.paginate(:all, :conditions => prepare_search_conditions, :order => ''created_at DESC'', :page => params[:page] ) if request.xhr? render :update do |page| page.replace_html "table", :partial =>
2006 Dec 07
3
Newbie Error Running specs
I''m new to rspec. I just installed these: rspec (0.7.4) RSpec-0.7.4 (r1201) (rspec gem) rspec_on_rails .3 plugin (on vendor/plugin) I''ve set up a simple spec - spec/library/test_spec.rb: require File.dirname(__FILE__) + ''/../spec_helper'' context "test context" do setup do #nothing end specify "nothing to specify" do
2007 Feb 15
4
defining context(s) dynamically
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Q. Why does code which defines a context work in the
2012 May 13
1
is assert_select_rjs deprecated in Rails 3.1 ?
I have seen it 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,
2007 Mar 27
2
mocking/stubbing newbie questions
I''m new to mocking and stubbing. Can someone help me out with the following? I don''t exactly know why this spec is failing: describe "GET /users/1/terms" do controller_name :terms setup do @user = mock_model(User) User.stub!(:find).and_return(@user) end def do_get get :index, :user_id => 1 end it "should find all terms
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