Displaying 20 results from an estimated 600 matches similar to: "Need help in View Spec"
2007 May 21
9
Ordering in view specs using have_tag and with_tag
When writing view specs is there any way to test not only for the
presence of tags (have_tag) and nested tags (with_tag), but also test
that they appear in a given order?
For example, consider the following:
it ''should display the login names, display names and email
address in alternating rows'' do
response.should have_tag(''div.odd>div'') do
2007 Feb 13
16
Error against latest trunk while testing via spec for model
Hi
I just did an update to lates trunk
=================
context "Given a generated venue_spec.rb with fixtures loaded" do
fixtures :venues
specify "fixtures should load two Venues" do
Venue.should have(2).records
end
end
==================
gives me
==========
1)
TypeError in ''Given a generated venue_spec.rb with fixtures loaded
fixtures should load two
2007 Sep 12
8
Can not ''assigns'' value in View test
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 website. But the
example is using instance variable. So I am looking for a way of assigning
my test data
2007 Mar 09
6
AssertSelect for strings?
Hi,
Is there a way to use the have_tag matcher on a string instead of the
response body from a view? I have a helper in a method rails project
that returns an html fragment which I would like to test.
Like this:
module SomeHelper
def some_helper_method
"<p>foo</p>"
end
end
context "The SomeHelper"
helper_name :some
specify do
2007 Aug 13
8
How to use expect_render?
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 well.
Below is the controller to be tested.
Controller
def index
pre
2009 May 23
9
undefined method `assert_select'
I''m having trouble getting the specs to run for a plugin where I want to
fix a bug. (I''ve actually already found and fixed the bug, but I don''t
want to submit a fix without a test!) When I started the specs weren''t
running, but it may be that I''m using Rails 2.3.3 and the plugin has
been tested on 2.1 and earlier. I went through writing a spec for a
2007 Jul 22
2
have_tag for href with specific link?
Hi folks,
I''m trying out this idea of "outside-in" and writing specs for my views
first. Being a person who generally starts with some scribbles of a user
interface and moves right to models, this has yet to be fun, but I''m
giving it a shot.
My question: I''m trying to specify that an index page should show a list
of things, each with a link to a delete
2007 Oct 05
4
have_xml_tag
Hi
Was just using have_tag on an xml response and found the problem
outlined and resolved here
http://weblog.jamisbuck.org/2007/1/4/assert_xml_select
Just wondered if there is any support in rspec?
Cheers
Shane
Shane Mingins
ELC Technologies (TM)
PO Box 247
Santa Barbara, CA 93102
Phone: +64 4 568 6684
Mobile: +64 21 435 586
Email: smingins at elctech.com
AIM: ShaneMingins
Skype:
2008 Mar 17
8
should have_tag outside Rails
Hi
Google has not helped me here. I''m looking for a way to use the have_tag
assert_select wrapper outside RSpec on Rails (but in a Rails project) so I
can use it to check text strings.
Has anyone managed this?
Thanks
Ashley
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 Jan 24
7
Differences between assert_tag and assert_select
Hi all,
I can't seem to make assert_select work for the more complex cases for me.
Here's a sample:
# View
<%= link_to_remote 'Add new', :url => new_phone_url, :submit => 'phones_head' %>
# Generated code:
<a href="#" onclick="new
Ajax.Request('http://test.host/admin/parties/phone/new',
{asynchronous:true, evalScripts:true,
2007 Sep 25
2
Testing for particular CSS (i.e. display: none)
I have a page that hides elements using CSS display: none.
I don''t expect RSpec to test any changes made by Javascript; I just want to
test how the page loads initially: what is visible and what is not.
Can I test this in RSpec? Or do I need to use something like Selenium?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 Aug 31
2
Can module spec "behave like" controller spec?
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 does. After
I saw the documentation, I then used :behaviour_type=>:controller.
2007 Aug 02
2
Do the :attributes and :content matchers work
[Rails plugin 1.0.5]
Hi,
I am looking for some guidance.
When working on a partial which looks like this
<div class="bug" style="width: 100%;" />
I have some examples which should fail - I think - but do not:
it '' should fail'' do
response.should have_tag( ''div.bug'', :content => ''There is no
2007 Jul 16
4
Accessing content_for html in view specs?
Hi All,
Hope all is going well.
I''ve got a few views that create some content using ''content_for'' blocks
<% content_for :blah do %>
.....
<% end %>
Has anyone worked out a way to be able to access the html that''s
generated inside those blocks?
Since they''re not part of the view, have_tag('''') seems to miss them,
2007 Aug 07
1
Rspec controller test
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 the test cases as the
parameters to these targeted methods in the controller spec?? Below is a
simple
2007 Aug 08
1
Failed to pass arguments to controller method
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
#do some coding
end
In the controller spec:
before(:each) do
@controller = Controller.new
2007 Aug 23
1
Can module spec use fixtures?
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 database) will affect other
specs of other modules (e.g. try to access the
2007 Sep 24
2
Is Rcov working with Jruby now?
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 coverage
tool. However, it is said that Rcov is not compatible with JRuby so far.
Sigh....I can not
2007 Aug 13
1
Problem of using fixture in Rspec
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 ran the
specs one by one, it was working. However, it failed when I tried to run all
the
2007 Aug 22
1
Can Rspec do module spec? What if module uses test data?
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 line of code followed by
''describe'' block. Luckily, it seemed to