similar to: Rails: View specs and implicit parameters in link_to()

Displaying 20 results from an estimated 6000 matches similar to: "Rails: View specs and implicit parameters in link_to()"

2009 Feb 05
3
[Cucumber, Webrat] Error backtraces shown as HTML in console
Since upgrading to Cucumber 0.1.99.19 I''ve noticed that the backtraces appearing in the console output are of the form: Page load was not successful (Code: 500): Followed by the dump of the rails error page. That page looks fine in a browser, and it''s helpful enough to see it when save_and_open_page does its thing, but I''m pretty used to reading plain old
2008 Dec 17
2
Help with link_to and its kin
Hi Everyone I am a new user of Ruby and Rails, and would like some help with the following problem. I have created a navbar with a styled unordered list and I would like to apply class="current" to the tab for the current page. Currently I am using a large, cumbersome and ugly if..then block, rendering the class="current" into the html and link_tos with current_page?. I am
2009 Apr 02
8
Problem with Custom matcher and Blocks
Hi, I''m trying to write my first custom matcher. Here''s a bit of my example group. describe "/contact/index" do include FormMatchers before(:each) do render ''contact/index'' end it "should show the contact form" do response.should have_a_contact_form end describe "the contact form" do context
2009 Feb 05
2
[Cucumber] Progress Bar
Inspired by Nick Evans'' RSpec progress bar[1], I had a little crack at implementing the progress bar for cucumber, ''cause I want to know how long a break I can take while the features are running :) It''s in my fork, in the coverage_formatter branch: http://github.com/mattwynne/cucumber/tree/master It will dump failing feature, scenario, step and the exception as
2008 Nov 03
1
stub! and null_object
I have some code I want to stub out as it''s not part of what I''m testing. It''s got a bit of DSL going on, so there are method calls chained together. The call I want to stub out looks like this: user.record_action(:uploaded_a_photo => concert).with_result(photo) So ideally, I''d just do @user.stub!(:record_action) and that would return a null
2011 Sep 13
12
Assertions for asynchronous behaviour
Hi all, In GOOS[1] they use an assertion called assertEventually which samples the system for a success state until a certain timeout has elapsed. This allows you to synchronise the tests with asynchronous code. Do we have an equivalent of that in the Ruby / RSpec world already? I know capybara has wait_until { } but that''s fairly rudimentary - the failure message isn''t very
2011 Mar 04
5
How to intercept an instance method from StdLib (1.9.2)
Hi, I''m struggling with something that seems to be simple, and I''ve not had any joy following the RSpec books suggestions (p. 187). I''d like to test that a method raises and error when a file is not found. I''ve tried adding this in my example just before I call my method, but it never seems to get invoked. Pathname.stub(:exist?).and_return(false) The whole
2009 Mar 05
8
Can I construct the controller myself in a controller spec?
Hi I am experimenting with Constructor based dependency injection for rails controllers. So I have something like this class LoginSessionsController < ApplicationController def initialize(authenticator = TheRealAuthenticator) @authenticator = authenticator end .... end The plan was to override the authenticator used when testing with something like describe
2008 Sep 09
12
cucumber - mark a step as pending
I love the way I can throw a call to pending() in the top of an unfinished RSpec example and stop it from failing the build. Is there a similar way to do such a thing with good ole'' cucumber? cheers, Matt ---- http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions expressed in this email are my own and do not necessarily reflect the views of any former,
2008 Aug 27
3
array_including()
I found myself having to write this today: class ArrayMatcher def initialize(array_to_match) @array_to_match = array_to_match end def ==(other) ok = true @array_to_match.each do |item| ok = ok and other.include?(item) end ok end end def array_including(array_to_match) ArrayMatcher.new(array_to_match) end Is there already something in the
2008 Aug 15
7
Autotest and subclasses / namespaces
I am writing a controller admin/cities_controller.rb it inherits from AdminController, so it''s defined like class Admin::CitiesController > AdminController Whenever I save the controller file, autotest freaks out: uninitialized constant Admin::AdminController (NameError) I''m pretty used to just hitting CTRL-C to get autotest to re-load all the files, or flicking to
2008 Sep 26
6
BDD / cucumber thought - chaining ''Then'' steps with Which
Going back to the debate about keeping state between steps, I found myself with the mild urge to be able to write this today: Given there is a user And the user has 20 friends Then I should see a thumbnail of each of the users''s friends Which should be a link to the user profile page for that friend NB: An idiom in this which may be songkick-only but was inspired by what
2008 Sep 24
19
How to define request.domain in when testing
Hi, My application relies on request.domain for doing its job. The problem I am encountering, is that when running tests, request.domain returns "test.host", how can I change that so that it returns "mysite.com"? Thanks in advance. -- Posted via http://www.ruby-forum.com/.
2008 Dec 13
4
Reuse of Cucumber Features
What''s the best way to handle a requirement that shows up as a sub-requirement requirement in other features? For example let''s say users can enter dates in various forms throughout my application. There is one set of global rules specifying the formats in which dates may be entered, and how they are interpreted. I put that in one feature. In various other features, like
2009 Apr 16
6
Cucumber - step negating another expecting step
On 16 Apr 2009, at 11:22, Joaquin Rivera Padron wrote: > at the moment I do it this way, hiding the complexity out of the > steps: > > Then /^I should see the people search form$/ do > people_search_form_exists > end > > Then /^I should not see the people search form$/ do > people_search_form_exists "not" > end > > and then the method: > >
2008 Sep 13
3
RCov / RSpec segfaults on Ubuntu
Hi all, I appreciate that this is not an RSpec question, but I wondered if anyone out there can offer some pointers. We''re using the latest versions of RSpec and RCov, and ruby --version says this (on the Ubuntu build server): ruby 1.8.6 (2008-07-17 patchlevel 279) [x86_64-linux] We''re getting intermittent (yes, intermittent!) segfaults from the build when running
2012 Oct 18
1
routing issue with mounted engine - Rails 3.2.8
I mounted the Forem::Engine in my app MyApp::Application.routes.draw do scope "/:locale" do ... resources :sites, :only => [:none] do get ''home'', :on => :collection get ''events'', :on => :collection end .. mount Forem::Engine, :at => "/forums", :as => :forums, constraints: lambda { |r|
2008 Aug 26
9
stub_model() and ActiveRecord Associations
Hi all, I have what I thought was quite a simple requirement but something to do with the way ActiveRecord''s associations work is making it quite puzzling. I guess I can sum it up with this failing test: before(:each) do @source_comment = @source.comments.create(:user_id => 1) @target_comment = @target.comments.create(:user_id => 1) end
2008 Nov 04
8
Testing a wizard with Cucumber
Assuming you have a multi-step wizard like thing, with lots of different states and paths through it. What approach would your use to write a feature for it? What I want to do is do the separate states and then reuse these things in more complex scenarios that cover paths. For example Scenario: State A Given I''m ... And I''m ... When I ... Then I should see And I at
2009 Apr 27
2
[cucumber] Setting a constant in step definition
On Mon, Apr 27, 2009 at 7:00 AM, Andrew Premdas <apremdas at gmail.com> wrote: > Currently I have a very simple constants implementation being loaded as a > Rails initialiser > > module MVOR > ? module Postage > ??? THRESHOLD = BigDecimal.new(''6.99'') > ??? RATE = BigDecimal.new(''30.00'') > ? end > end > > > My scenarios