[rspec-users] Rspec controller test

2007-08-07 Thread Shaker
Great Hi to everybody! I am currently working on a project which tests the controllers using rspec. I came across some methods in the controller which do not generate any actions at all. However, they still need testing! Some of these methods do require parameters. I am wondering how I can pass th

[rspec-users] Failed to pass arguments to controller method

2007-08-07 Thread Shaker
Good morning to everyone: So weird!! I got a method called apply_settings(arg1, arg2) in the controller to be tested. In the controller spec, I of course called the method. In the controller: def apply_settings(arg1, arg2) #where arg1 is a hash, and arg2 is an array of object #d

[rspec-users] Problem of using fixture in Rspec

2007-08-12 Thread Shaker
Dear Fellows: I was using fixtures in the model tests using Rspec. I found that the test data specified in the fixtures was stored in the test database once I ran the spec and won't be removed anyway. Is my observation correct? There might be another problem regarding the fixtures. When I

[rspec-users] How to use expect_render?

2007-08-13 Thread Shaker
Hi: I am a rspec beginner. I have scratched my head for the whole afternoon, trying to figure out a way of writing render expectation in controller spec. However, I failed. It kept telling me that the 'expect_render' was an undefined method. I have installed rspec 1.0.8 and rspec_on_rails as w

Re: [rspec-users] How to use expect_render?

2007-08-13 Thread Shaker
http://rspec.rubyforge.org/documentation/rails/writing/controllers.html writing controller spec Thanks, regards. aslak hellesoy wrote: > > On 8/13/07, Shaker <[EMAIL PROTECTED]> wrote: >> >> Hi: >> I am a rspec beginner. I have scratched my head for the whole >> af

Re: [rspec-users] How to use expect_render?

2007-08-13 Thread Shaker
d way gave me an error: undefined method 'expect_render' Do I need to mock the controller or there are some mistakes I have made in my spec? Shaker wrote: > > Hi: > I am a rspec beginner. I have scratched my head for the whole > afternoon, trying to figure out a way of wr

Re: [rspec-users] How to use expect_render?

2007-08-13 Thread Shaker
lways gave me an error:Mock 'expect_render_mock_proxy' expected :render with ({:partial=>"index"}) once, but received it 0 times. Is it because "expect_render" is not compatible with JRuby or I forgot to mock something? Thanks a lot. Regards. aslak hellesoy wro

[rspec-users] Can Rspec do module spec? What if module uses test data?

2007-08-21 Thread Shaker
Dear fellows: I am currently working on writing specs on some ruby modules(e.g. myModule). At first I try to use script/generate to generate rspec_module, but it failed. :-( Later I manually created a file (e.g. named myModule_spec.rb) and put the 'require spec_helper.rb' as the first

[rspec-users] Can module spec use fixtures?

2007-08-22 Thread Shaker
Good morning, dear fellows: I'd like to recall one question I posted yesterday. I am writing specs for ruby modules. Some of the modules do some data process in the test database. Because 'fixtures' is undefined (Am I correct?) in module specs, spec of certain module (e.g. delete data form dat

[rspec-users] Can module spec "behave like" controller spec?

2007-08-31 Thread Shaker
Hello everyone: Right now I am writing spec on modules, which are provided by my colleagues. Some of the modules actually contain action methods. I tried very hard to spec those action methods in modules. But it seems that the rspec does not allow module spec to 'get' action like controller d

[rspec-users] How to test 'Paginate'?

2007-09-10 Thread Shaker
Great Hi to everyone: I don't know how to write spec for a controller method which has 'paginate'. Is there any Rspec API for it? To illustrate, I would like to post an example. class PeopleController def paginate_method hash = Hash.new hash[:people_page], hash[:people] = paginate :

[rspec-users] Can not

2007-09-12 Thread Shaker
-- View this message in context: http://www.nabble.com/Can-not-tf4427918.html#a12631491 Sent from the rspec-users mailing list archive at Nabble.com. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-u

[rspec-users] Can not 'assigns' value in View test

2007-09-12 Thread Shaker
Hello everyone: I am quit new to View test using rspec. I want to write spec for a partial, which is rendered by a controller. However, the controller does not pass data to the partial using instance variables, it uses symbol variable instead. I read the example of view spec provided in the webs

Re: [rspec-users] Can not 'assigns' value in View test

2007-09-12 Thread Shaker
? Modify your view to use @hash instead. > > http://rspec.rubyforge.org/documentation/rails/writing/views.html > >> >> On Sep 12, 2007, at 5:20 AM, Shaker wrote: >> >> > >> > Hello everyone: >> > I am quit new to View test using rspec. I want to write sp

Re: [rspec-users] Can not 'assigns' value in View test

2007-09-12 Thread Shaker
ash %> to get the hash data passed from the controller. Maybe the :locals does some magical work here. I am quite familiar with rspec and ruby. So I am reading more documentation now. Hopefully we could figure it out shortly. David Chelimsky-2 wrote: > > On 9/12/07, Shaker <[EMAIL PROTECTED

Re: [rspec-users] Can not 'assigns' value in View test

2007-09-12 Thread Shaker
imsky-2 wrote: > > On 9/12/07, Shaker <[EMAIL PROTECTED]> wrote: >> >> I also feel puzzled. But that's what my colleagues do, and it works. The >> thing is they use >> render :partial=>'index', :locals=>{:hash=>hash} >> in the controll

[rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
Hello everyone: I am kind of puzzled in writing spec on view partials. I can not find much information about the "should have_tag" syntax in Rspec. Can rspec test a particular attribute of a tag (e.g. input tag)? Let me put an example here: #../view/group/_index I want to test the "on

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
ct a tag, whereas I don't know how to select an attribute and test it! Another problem is the tag does not have id or class sometimes, does it mean that is no way of selecting it? David Chelimsky-2 wrote: > > On 9/13/07, Shaker <[EMAIL PROTECTED]> wrote: >> I can not find m

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
Sorry, that's another spec caused the error. It is working. Thank you very much Shaker wrote: > > Hello > To spec the example I mentioned before, I wrote the spec as what you > suggested > #../view/group/index_spec.rb > describe "/group/_index_spec" do >

Re: [rspec-users] Need help in View Spec

2007-09-13 Thread Shaker
ag("input[onclick=?]", "update()") end end However, it generated an error "Expecting a selector as the first argument". What is wrong? David Chelimsky-2 wrote: > > On 9/13/07, Shaker <[EMAIL PROTECTED]> wrote: >> >> Yes, I have gone th

[rspec-users] Is Rcov working with Jruby now?

2007-09-23 Thread Shaker
Hello everyone: I am currently assigned to test a big project which uses JRuby to build a web application. The reason of using JRuby is the web application is communicating with Java Service. I am writing test cases using Rspec and looking for a code coverage tool. Rcov is no doubt a nice code c

[rspec-users] weird behavior of mocking ruby class methods

2007-12-06 Thread Shaker
Hello everyone: After I played with Rspec for three months, I realized a weird behavior of mocking ruby classes (e.g. File). Please let me post a sample code before I point out the problems: #file_reader.rb (to be tested) class FileReader def do_read File.read('asd.txt') end