[rspec-users] Problem with mocking helper methods

2011-11-11 Thread Ervin
Given that I assume that rails helper image_tag works as intended, I want to mock out call to this method in my helper. spec/helpers/some_helper_spec.rb: require 'spec_helper' describe SomeHelper do it 'allows stub tags' do helper.should_receive(:image_tag).with(2).and_return(3)

[rspec-users] Problem with mocking helper methods

2011-11-14 Thread Ervin
Given that I assume that rails helper image_tag works as intended, I want to mock out call to this method in my helper. spec/helpers/some_helper_spec.rb: require 'spec_helper' describe SomeHelper do it 'allows stub tags' do helper.should_receive(:image_tag).with(2).and_return(3)

Re: [rspec-users] what would be the best way to stub out an XHR request's response?

2012-09-26 Thread Ervin Weber
You could create some function (say window.GiveMeUrlForAjax) that returns uri for ajax request, your test could then easily overwrite that function before triggering event to perform ajax. Also you might consider creating a function that returns data (in production it would take url from "GiveMeUrl

Re: [rspec-users] Simular to Include

2013-02-27 Thread Ervin Weber
Misunderstood examples. Array1.collect{|s| s.split ('/').last}.should == array2 seems closer to your intent. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Simular to Include

2013-02-27 Thread Ervin Weber
(Array1 - array2).should be_blank maybe? On 28 Feb 2013 07:42, "Mattias A." wrote: > Hi, > > I have array1 that contains several web address. Array2 contains the > expected endings of array1 values. How can I control that arrays2 values > is in array1? > > I have tried array1.should include array

[rspec-users] Different description in custom RSpec::Matcher depending on output formater

2013-04-09 Thread Ervin Weber
else # for other formats condensed output "return JSON:\n#{expected}" end end end I plan to use this running two formatters at same time -f doc and -f html at same time to produce pretty HTML file, and relatively condensed doc in console. Big th