[rspec-users] lots of nil problems!

2010-03-19 Thread Patrick J. Collins
ntacts/shipping_label") end -- but that gives me: 'Admin::ShippingLabelsController should render a pdf file' FAILED expected "admin/contacts/shipping_label", got nil /Users/patrick/coding/rails/matthew/spec/controllers/admin/shipping_labels_controller_spec.rb:11: than

Re: [rspec-users] lots of nil problems!

2010-03-20 Thread Patrick J. Collins
I am sorry for being so confused If you can break this down, I'd really appreciate it. Thank you. Patrick J. Collins http://collinatorstudios.com On Sat, 20 Mar 2010, Nick Hoffman wrote: > Hey Patrick. > > > I have this in my controller action: > > > &

Re: [rspec-users] lots of nil problems!

2010-03-20 Thread Patrick J. Collins
; "mock_model" and "should_receive" since they all are "mocking"...? Patrick J. Collins http://collinatorstudios.com On Sat, 20 Mar 2010, David Chelimsky wrote: > On Sat, Mar 20, 2010 at 2:28 AM, Patrick J. Collins > wrote: > > 4.  You do .stub! ..

Re: [rspec-users] lots of nil problems!

2010-03-20 Thread Patrick J. Collins
AR::base def lowered_name name.downcase end def upper_name name.upcase end def numbers rand(id) end def pdf # return some prawn pdf object end ... If you could do that for me, it would be incredibly awesome... Thank you. Patrick J. Collins http://collinatorstudios.com > started usi

[rspec-users] continuing on my quest to learn rspec...

2010-03-23 Thread Patrick J. Collins
Ok, So... My first attempt at specing a method in my photo model didn't go so well.. http://gist.github.com/341447 Both of these tests are failing, and I am not even sure if I am structuring this anywhere near correct or not... In other words... HELP!!!!!! Patrick J. Collins

Re: [rspec-users] continuing on my quest to learn rspec...

2010-03-24 Thread Patrick J. Collins
what am I doing wrong as far as my spec goes, because I am getting: 'PhotoAlbum saving a photo should set the cover of the album to the curent photo when 'album cover' is checked' FAILED expected: #, got: nil (using ==) ... Thank you in advance for your patience and guida

[rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
iations/association_proxy.rb:217:in `method_missing' /Users/patrick/coding/rails/xyz/app/models/vcard.rb:164:in `card_photo' Any ideas? Thanks.. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
I changed .should_receive to .stub! and then the errors went away. Not sure if that was the right thing to do in that case. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
s to be intercepted by .should_receive is dependent on the number of addresses in a vcard. This was the problem I didn't know how to address, and using stub! resolved it, but like I said-- I didn't know if there's a more appropriate way to do it. Patrick J.

Re: [rspec-users] a MockExpectationError problem

2010-04-25 Thread Patrick J. Collins
photo = Photo.create(...) to Photo.create(...) then the spec passes... It's when that @contact.photo = is there that it breaks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
require initializer methods (setup/setup_something_else) to be called. So I am just wondering, what is the proper technique to test these private mini_methods? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-user

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
When you test the > higher level methods you can mock this stuff. When you test the small > methods you should call them directly. So is it bad practice then to use private methods? I have a habit of doing that-- but from what you're saying there is no way to test those things individ

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
> Also, you should directly test the implementation of the Vcard outside of > this spec (i.e. in it's own spec) Could you explain what you mean by that? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
method end def slave_method foo end def foo=(new_foo) @foo = new_foo end def foo @foo end ..... ? Is that the way to go??? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
gs that can be tested. Passing in a variable is definitely less elegant than using an instance variable, and a getter/setter is somewhat too (in my opinion). Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-use

[rspec-users] rcov not working?

2010-04-28 Thread Patrick J. Collins
_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] more rspec questions

2010-04-28 Thread Patrick J. Collins
: http://gist.github.com/383233 I solved my @contact.photo = problem by approaching it a different way... Though I still wish someone could tell me what the deal was with that mock expectation error. No one seemed to reply to that question... Anyway, everything passes so I guess I can move on to the

[rspec-users] update_attributes fails in rake spec but not in script/spec???

2010-04-30 Thread Patrick J. Collins
m_count, 4) ArgumentError Exception: wrong number of arguments (0 for 3) (rdb:1) self # ... Can anyone please explain to me why this is behaving this way? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list r

Re: [rspec-users] update_attributes fails in rake spec but not in script/spec???

2010-05-01 Thread Patrick J. Collins
spec that when I delete, the other one that failed now passes: http://gist.github.com/386125 This is so weird, I would really love it if someone could shed some light on this. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list

Re: [rspec-users] update_attributes fails in rake spec but not in script/spec???

2010-05-01 Thread Patrick J. Collins
now passes all test. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] named route failing in class spec

2010-05-01 Thread Patrick J. Collins
;should have a link" do @foo.link.should match /href/ end ... But I get this error: NoMethodError in 'FooRenderer should have a link' undefined method `foo_path' for # ... What can I include in my spec to get foo_path to be recognized? Thank you. Patr

Re: [rspec-users] named route failing in class spec

2010-05-02 Thread Patrick J. Collins
> Whate versions of ruby, rspec, and rails are you using? Please make it a > habit to include this information in queries like this. ruby 1.8.7 rails 2.3.5 rspec 1.3.0 Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list

Re: [rspec-users] named route failing in class spec

2010-05-02 Thread Patrick J. Collins
Thank you. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] customize output of script/spec?

2010-05-22 Thread Patrick J. Collins
what is different between the expected and got.. Is there perhaps a way to make it so that the actual differences have a different foreground or background color in the terminal? Thanks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users

[rspec-users] weirdness with rake spec!

2010-06-23 Thread Patrick J. Collins
is a problem I have had to face over and over, and has proven to be quite frustrating. The only solution I have found is to pass self into the method.. So if anyone has any other suggestions, I'd love to hear it. Thank you. Patrick J. Collins http://collinatorstudios.com _

Re: [rspec-users] weirdness with rake spec!

2010-06-23 Thread Patrick J. Collins
- It's actually in: spec/helpers/renderers Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] weirdness with rake spec!

2010-06-23 Thread Patrick J. Collins
class so that I won't have conflicts with other instance variables... I don't understand though why rake spec would fail but script/spec wouldn't... Is there something different about the environment when rake spec is called? Patrick J. Collins http://

[rspec-users] rake 0.9.0 activated error + debugger not working?

2011-06-06 Thread Patrick J. Collins
r bundle seem to like -d or --debug.. So I am totally confused on this one... Thanks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] rake 0.9.0 activated error + debugger not working?

2011-06-06 Thread Patrick J. Collins
uot; rake spec -d gives me: "ambiguous option: -d" rake spec --debug gives me no output at all... thanks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] rake 0.9.0 activated error + debugger not working?

2011-06-06 Thread Patrick J. Collins
> rake doesn't take arguments like that. Try 'rspec spec --debugger'. Hmm, that gives no output at all.. I just get a bash prompt immediately after entering 'rake spec --debugger' Patrick J. Collins http://collinatorstudios.com ___

Re: [rspec-users] rake 0.9.0 activated error + debugger not working?

2011-06-06 Thread Patrick J. Collins
> rspec, not rake: Oops! I missed that.. So other than this debugger thing, are there any other differences between rake spec and rspec spec? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org h

Re: [rspec-users] rake 0.9.0 activated error + debugger not working?

2011-06-07 Thread Patrick J. Collins
ts is identical between 'rake spec' and 'spec rspec' Which I am assuming by your answer that it is. Rake spec runs a task that probably just does: 'spec rspec' ? Patrick J. Collins http://collinatorstudios.com ___ rspec-u

[rspec-users] testing framework in 44 lines of ruby

2011-06-12 Thread Patrick J. Collins
Hi everyone, I just came across this post and was wondering if this is on target with how RSpec works under the hood? http://www.skorks.com/2011/02/a-unit-testing-framework-in-44-lines-of-ruby/ Patrick J. Collins http://collinatorstudios.com

Re: [rspec-users] testing framework in 44 lines of ruby

2011-06-12 Thread Patrick J. Collins
cursively calling itself. In that post's example, their definition of should simply returns self as they described "it's just syntactic sugar to make the tests read better", but from looking at RSpec's code, it seems like there's a lot more going on, but I

Re: [rspec-users] how to mock/stub when there are multiple model objects?

2011-06-17 Thread Patrick J. Collins
> but what if my method looks like: > >    user = User.where("...") >    user2 = User.where("...") User.should_receive(:where).with("...").and_return(...) http://apidock.com/rspec/Spec/Mocks Patrick J. Collins http://collinatorstudios.com___

Re: [rspec-users] Testing complex-form-example helpers

2011-07-18 Thread Patrick J. Collins
em manually with behavior driven development? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] question regarding how to test posting form data with Net::HTTP

2011-07-21 Thread Patrick J. Collins
ion, but--- is that really worth doing? Thank you in advance for your input. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Keeping my integration specs DRY..

2011-07-25 Thread Patrick J. Collins
tion" do fill_in :login, :with => @user.email fill_in :password, :with => @user.password click_button "login_button" page.has_content?("Logged in successfully") end Then in your specs you can do: describe User do it_behaves_like &quo

[rspec-users] how can I get rspec to generate files with rails g model ...?

2011-09-12 Thread Patrick J. Collins
test unit", and a test/unit/foo_test.rb gets created.. .. Is there something I need to do to get rspec invoked? Thanks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.o

[rspec-users] using rspec to verify an xpath (via capybara/cucumber)

2011-09-20 Thread Patrick J. Collins
I am doing: page.should have_xpath("//img[contains(@class, 'foobar')]", :count => 0) but cucumber tells me: expected xpath "//img[contains(@class, 'foobar')]" to return something (RSpec::Expectations::ExpectationNotMetError) ... Shouldn&

[rspec-users] preferred place for methods used by both rspec and cucumber?

2011-09-21 Thread Patrick J. Collins
ot;))) end that I want to use in both cucumber step definitions and rspec. Is there a preferred place to store this code, or is it standard practice to just define them in a module in config/inititalizers and include that in both cucumber's env.rb and rspec's spec_helper.rb? Thanks. Pat

[rspec-users] how to test identical behavior without being redundant?

2011-09-26 Thread Patrick J. Collins
tifications.should_not be_blank post.destroy post.notifications.reload.should be_blank end end etc... Is there an ideal way to dynamically generate this for any models that respond to notificaions so that I don't have redundant noisy tests? Thanks. Patrick J.

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
> Am I correct in understanding that the point of using let is that it can > minimize database calls due to memoization? > > describe "#something" do > > let(:something) = Something.groovy_scope and obviously I meant let(:something) { ... }, not = (oops)

[rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
@something.first.y.should_not have_coolness end end ... Is that the proper usage? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
arl foo.wurd_up end end vs. describe "Foo" do before :each do @foo = Foo.new end it "seems just as tubular as the foo w/ let" do @foo.bar @foo.baz end it "seems just as gnarly as the foo w/ let" do foo.gnarl

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
really would shine because it would not require records to be repeatedly created... Do you guys feel like before(:all) is just bad because of the possibility of a method call in one example changing the state and therefore breaking future examples and not having it be clear as to why..

[rspec-users] understanding rspec predicates

2011-10-10 Thread Patrick J. Collins
I know I can do: blah.should be_empty or blah.should have_key(:to_my_house) ... But, is there a way to do: str = "lmaonade omg rotfcopter!" str.should start_with("lmao") Or is it just best to do: str.starts_with?("lmao").should be_true ? Patrick J. Collin

Re: [rspec-users] understanding rspec predicates

2011-10-11 Thread Patrick J. Collins
> On Oct 10, 2011, at 8:17 PM, Patrick J. Collins wrote: > > > I know I can do: > > > > blah.should be_empty > > > > or > > > > blah.should have_key(:to_my_house) > > > > ... > > > > But, is there a way to do: > &

Re: [rspec-users] understanding rspec predicates

2011-10-11 Thread Patrick J. Collins
So the rule is, any predicate method that starts with "has_" can be replaced with "have_", and all others would begin with "be_". Got it Thanks! Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] instance variables from outer before blocks don't persist?

2011-10-12 Thread Patrick J. Collins
seems that my @foo ivar is non existant inside the inner context.. Is this the way it's supposed to be? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] instance variables from outer before blocks don't persist?

2011-10-13 Thread Patrick J. Collins
> > ... But I just tried doing this in RSpec with before :each, and it seems > > that > > my @foo ivar is non existant inside the inner context.. Is this the way > > it's supposed to be? > > post the whole example Nevermind.. I figured out what I was do

[rspec-users] view_context in specs

2011-11-02 Thread Patrick J. Collins
listic. Is the best way to get a real-world view context in there to do something like: Blah.new(ActionView::Base.new) ? Or does RSpec have something magical already setup for this sort of thing? Muchas Gracias. Patrick J. Collins http://collinatorstudios.com ___

Re: [rspec-users] view_context in specs

2011-11-02 Thread Patrick J. Collins
this functionality is to do: @context = ActionController::Base.new.view_context then you can do @context.render, @context.content_tag, etc. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] problems matching generated html output...

2011-11-03 Thread Patrick J. Collins
t the window. Is there something I should be doing with a custom matcher or something to test for case-indifferent text, ignore whitespace and \n, and be quote indifferent? Thanks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] problems matching generated html output...

2011-11-03 Thread Patrick J. Collins
se it deals with HTML. Am I totally on crack? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] problems matching generated html output...

2011-11-03 Thread Patrick J. Collins
ng the raw HTML? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] need some advice on the best way to structure testable shared methods

2011-11-14 Thread Patrick J. Collins
s Foo < Nameable ... end class Bar < Nameable ... end And then I can have a dedicated spec for Nameable and not worry about testing that in Foo and Bar... But, I am not 100% crazy about that approach either. Can anyone suggest a better way? Thanks! Patrick J. Collins http://c

Re: [rspec-users] need some advice on the best way to structure testable shared methods

2011-11-14 Thread Patrick J. Collins
method have actual argument expectations. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] need some advice on the best way to structure testable shared methods

2011-11-14 Thread Patrick J. Collins
tialize(arg1) ... end end class Bar include NameBuilder def initialize(arg1, arg2, arg3) ... end end ... In this case, "described_class.new(nil, nil)" is not going to work out very well. Patrick J. Collins http://collinatorstudios.com

[rspec-users] testing a post to a controller's create action

2011-11-18 Thread Patrick J. Collins
st, binding.pry or debugger interrupts the test flow and gives me access to the current scope of the debugger call. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Patrick J. Collins
I could choose to go about this differently and use a real post attribute-- but I am just curious if there is a way to isolate the testing of this method and make #create not even connected in any way? I was thinking originally that I should be able to do (prior to the post create call): PostsCont

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Patrick J. Collins
_post).returns true still gives me the same failure, unknown attribute: foo in 'new'... But, manually testing stuff proves that exposed_for_post method IS being called, and everything is working.. I just want an automated test to prove it. I am totally stumped on this one... Patr

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Patrick J. Collins
y doing something like: fake_post = stub('Post', :save => true) Post.stubs(:new).returns(fake_post) But I still get that same failure. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] testing a post to a controller's create action

2011-11-20 Thread Patrick J. Collins
rify, and I still get the same error. Seems so weird to me. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] cucumber is_admin? testing

2011-11-23 Thread Patrick J. Collins
e access to your application controller's @current_user variable. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] test for "lambda {...}.should change(x, y).by(z)" failing.. ?

2011-11-23 Thread Patrick J. Collins
m confused why the lambda {}.change thing isn't working? Thanks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] test for "lambda {...}.should change(x, y).by(z)" failing.. ?

2011-11-24 Thread Patrick J. Collins
est overwrite the mark helpful value of that constant like: Event:SCORES[:mark_helpful] = { :reputation_change => 123 } But that felt a little wrong so I chose to just rely on a class convenience method to return the constant's value. Any thoughts on these

Re: [rspec-users] oddness with messages_path

2011-11-26 Thread Patrick J. Collins
. I believe you want to do "message_path(message)" instead of "messages_path(message)" Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] is there a convention for testing that a record exists?

2011-11-29 Thread Patrick J. Collins
ser created" post = create_post(:user => user) # this will make an event record of type "post created" post.share! Event.exists?(:event_type => "post shared").should be_true end ... I'm just not sure what's the best way to go, and if there'

[rspec-users] problem setting expectation for test with delayed::job

2011-12-01 Thread Patrick J. Collins
troller_spec.rb:8:in `do_post' # ./spec/controllers/post_controller_spec.rb:77 # ./spec/controllers/post_controller_spec.rb:75 Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] problem setting expectation for test with delayed::job

2011-12-01 Thread Patrick J. Collins
n any event, after reading what you wrote I got my test to pass by doing: PostSharer.expects(:new).once.returns stub("Fake Post Sharer", :perform => true) So this way delayed_job still can call perform on the fake object and everyone is happy (especially me). Pat

Re: [rspec-users] rspect weird problem

2011-12-05 Thread Patrick J. Collins
ObjectSpace.each_object(Motorcycle) do |o| return o if o.name == name end end Will return found object immediately or nil if nothing is found. Patrick J. Collins http://collinatorstudios.com ___ rspe

Re: [rspec-users] rspect weird problem

2011-12-06 Thread Patrick J. Collins
a motorcycle by name" do ...etc end end Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] how to test arguments going into a mailer method?

2011-12-08 Thread Patrick J. Collins
lling::Integrations::Paypal::Notification.new(any_parameters) # ./lib/paypal_param_processor.rb:43:in `send_email' # ./spec/lib/paypal_param_processor_spec.rb:63 # ./spec/lib/paypal_param_processor_spec.rb:63 --- So, obviously my approach isn't so great. Can a

Re: [rspec-users] RSpec mock question

2012-01-09 Thread Patrick J. Collins
LPRC::Client.should_receive(:new3).with(options).and_return(client) Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] id getting overwritten with 0 when testing

2012-01-25 Thread Patrick J. Collins
environments: rake db:test:clone_structure Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] nested route not receiving :id parameter within controller spec

2012-02-06 Thread Patrick J. Collins
:on => :member end rake routes shows: share_post POST /posts/:id/share(.:format) {:action=>"share", :controller=>"posts"} ... Why is it ignoring the :id parameter in my test and therefore blowing up? Thanks. Patrick J. Collins http://collinatorstudios.

Re: [rspec-users] nested route not receiving :id parameter within controller spec

2012-02-06 Thread Patrick J. Collins
osts"} So I don't see how that can be the case... Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] nested route not receiving :id parameter within controller spec

2012-02-07 Thread Patrick J. Collins
> Sorry, too quick to answer. > Next clue is the fact that the RSpec error is ignoring your id attribute. > try: > post :share, :id => 42 > and see if that gets you past the current error Yeah-- Unfortunatley I also had tried this and got the same result... Patri

[rspec-users] stale records with integration testing?

2012-02-13 Thread Patrick J. Collins
wiped clear? Is that not the case? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] stale records with integration testing?

2012-02-14 Thread Patrick J. Collins
lts... I just put that code back in spec_helper, and ran my specs and they fail again with "email already taken". It seems to break unless I explicitly put: User.all.map(&:destroy) in a before block Is there any reason why DatabaseCleaner might not be working? I&

Re: [rspec-users] stale records with integration testing?

2012-02-14 Thread Patrick J. Collins
appropriate one. Ah... Ok cool, all of the above info solved my problem. Thanks! Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] should_receive_chain

2012-02-21 Thread Patrick J. Collins
> Would you like to do this? > > account.should_receive_chain(:users, :active, :first) +1 from me! Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] initializer require weirdness only within rspec?

2012-02-22 Thread Patrick J. Collins
ls.root for those two files fixed the problem: # initializers/core_ext.rb require "core_ext/array.rb" require "#{Rails.root}/lib/core_ext/hash.rb" require "core_ext/numeric.rb" require "core_ext/float.rb" require "#{Rails.root}/lib/

[rspec-users] i've been in activeadmin hell...

2012-04-06 Thread Patrick J. Collins
.0/lib/rspec/core/runner.rb:10:in `block in autorun' ... Changing the filename app/admin/users.rb to app/admin/wtfs.rb makes this error go away... so--- wtfs indeed! incidentally if you are wondering what is this business with confirmations_controller (in the stack trace), that just inherits from

Re: [rspec-users] i've been in activeadmin hell...

2012-04-06 Thread Patrick J. Collins
> On Apr 6, 2012, at 11:21 AM, Patrick J. Collins wrote: > > ... Changing the filename app/admin/users.rb to app/admin/wtfs.rb > > > > makes this error go away... so--- wtfs indeed! On Fri, 6 Apr 2012, Justin Ko wrote: > I'm pretty sure this is an issue with how Rai

Re: [rspec-users] i've been in activeadmin hell...

2012-04-06 Thread Patrick J. Collins
ll see activesupport trying to > handle that error with its `load_missing_constant` method. I assume it > "searched" for a file named "users", because the constant was named "Users". > WTF doesn't cause an error, because activesupport does

[rspec-users] how can I get prettier failure messages for integration specs?

2012-04-18 Thread Patrick J. Collins
operly. Is this possible? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] how can I get prettier failure messages for integration specs?

2012-04-18 Thread Patrick J. Collins
egration tests? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] how can I get prettier failure messages for integration specs?

2012-04-18 Thread Patrick J. Collins
On Thu, 19 Apr 2012, David Chelimsky wrote: > Try this: > > RSpec.configure do |c| >   c.after(:each, :type => :request) do >     save_and_open_page if example.exception >   end > end > > Thank you so much! That works perfect

[rspec-users] how can I stub out external service calls during integration tests?

2012-04-18 Thread Patrick J. Collins
t;>'; return false; } Is there a better way to do this? Thanks. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] stuck in testing hell...

2012-04-30 Thread Patrick J. Collins
ion my tests still are breaking because of some other undetermined problems having to do with OpenStruct not being as "simple" of a solution as I was hoping. ... AAGH! Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] stuck in testing hell...

2012-05-01 Thread Patrick J. Collins
ord no longer handles the setter/getter methods for that column, and this issue goes away. GH! So I am out of testing hell now.. yay! Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] rspec 2.10.0 breaks controller specs...

2012-05-04 Thread Patrick J. Collins
p125@my_app/gems/rspec-core-2.10.0/lib/rspec/core/runner.rb:69:in `run' # /Users/patrick/.rvm/gems/ruby-1.9.3-p125@my_app/gems/rspec-core-2.10.0/lib/rspec/core/runner.rb:10:in `block in autorun' Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Preferred way to predict behavior in controller spec?

2012-05-04 Thread Patrick J. Collins
long trailing echo) "any_instance is terrible practice.. never use it!" So I am curious if anyone has suggestions on how this might be improved? Thank you. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] is there a way to turn on :js => true in the middle of a spec?

2012-05-09 Thread Patrick J. Collins
xcute that test a bit? Or is that just impossible with the way headless vs browser stuff works? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] how do I test for a status code in a :js => true test?

2012-05-09 Thread Patrick J. Collins
poses, but I was hoping for a better way... Any ideas? Thank you. Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] how can I do an "or" within the context of a matcher?

2012-05-14 Thread Patrick J. Collins
nk(locator) || have_button(locator) end But that doesn't work... Is there any way to do this? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] shared examples with a block for expects?

2012-05-23 Thread Patrick J. Collins
rolled action", proc { do_create } end end but I get: "expected CanCan::AccessDenied, got #" Just curious, how can I do this? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] alternate way to stub out I18n translations?

2012-05-30 Thread Patrick J. Collins
dynamically? In other words, so that instead of stubbing I could just do something like: I18n.t("waka")[:waka] = "hooray!" and then in code can still access I18n.t("waka.waka").. But that doesn't work, and I am not sure how to pull that off... Any help would be gre

  1   2   >