Displaying 19 results from an estimated 19 matches similar to: "Rspec controller test"
2007 Sep 27
2
1.0.8 tarball problem.
When I untar 1.0.8 after having downloaded it from rubyforge, I get
these errors:
<snip>
rspec-1.0.8/spec/spec/runner/spec_parser_spec.rb
rspec-1.0.8/spec/spec/spec_classes.rb
gzip: stdin: decompression OK, trailing garbage ignored
rspec-1.0.8/spec/spec/translator_spec.rb
rspec-1.0.8/spec/spec_helper.rb
rspec-1.0.8/UPGRADE
tar: Child returned status 2
tar: Error exit delayed from
2007 Feb 15
4
defining context(s) dynamically
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Q. Why does code which defines a context work in the
2006 Nov 22
1
rspec_on_rails (MissingSourceFile)
Hi there,
I''ve installed rspec, rails plugin & generators thusly:
$ sudo gem install rspec
$ sudo gem install rspec_generator
$ sudo gem install zentest -v 3.4.1
$ ./script/plugin install
svn://rubyforge.org/var/svn/rspec/tags/REL_0_7_2/vendor/rspec_on_rails/vendor/plugins/rspec
$ ./script/generate rspec
$ ./script/generate rspec_model ModelName
With Rails version:
$ rails
2006 Nov 03
10
[PLUGIN] rspec_resource_generator - RESTful scaffold generator with RSpec specifications
rspec_resource_generator
========================
By Pat Maddox
Use this generator to generate RESTful scaffolding with RSpec specifications.
Syntax is exactly the same as the scaffold_resource generator:
./script/generate rspec_resource ModelName [field:type field:type]
When you run this generator, it will create a migration, model, and
model spec file. In addition, it gives you a RESTful
2012 Nov 12
7
RSpec: controller POST create
Rails 3.1.3
rspec-rails (2.11.4)
rspec 2.11.1
I am new to rspec. I don''t quite understand tests for POST create part.
I have generated scaffold, and simultaneously it generated
controller_spec.rb as well.
it "assigns a newly created plan as @plan" do
post :create, {:plan => valid_attributes}, valid_session
assigns(:plan).should be_a(Plan)
2007 Oct 12
3
Strange mock_model behaviour with ActiveResource model
Hi,
I have two models in an app that inherit from ActiveResource::Base.
The scaffold controller tests for one of the models works fine, but
the other one dies when calling mock_model in the "handling GET
/fa_codes" spec:
Specifically, the call to mock model here:
before do
@fa_code = mock_model(FaCode)
FaCode.stub!(:find).and_return([@fa_code])
end
generates this failure:
2006 Nov 22
0
rspec_on_rails MissingSourceFile
Hi there,
I''ve installed rspec, rails plugin & generators thusly:
$ sudo gem install rspec
$ sudo gem install rspec_generator
$ sudo gem install zentest -v 3.4.1
$ ./script/plugin install
svn://rubyforge.org/var/svn/rspec/tags/REL_0_7_2/vendor/rspec_on_rails/vendor/plugins/rspec
$ ./script/generate rspec
$ ./script/generate rspec_model ModelName
With Rails version:
$ rails
2009 Feb 20
6
How to mock an object defined in the before_filter function?
Hello,
I am trying to implement the following scenario, but I am stuck ...
The thing is I want to initialize a variable @comment when the stub
function "find_comment" is called.
The way I do it below doesn''t work, since
"before_filter :find_comment" returns true/false and @comment
initialization is done inside it. Could you please give me a hint how
to do it?
One
2007 Sep 14
6
Need help in View Spec
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
<div id="test">
<input type="button" value="update" onclick="update()"
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
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 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 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
2007 Jul 26
5
Coding standards and whitespace
Recently as a result of using Git I''ve noticed a number of
inconsistencies in the RSpec codebase with respect to whitespace
(mixed line endings, mixed use of spaces and tabs for indentation,
and trailing whitespace at the end of lines). I never would have
noticed, but Git produces nice colorized diff output which highlights
these kinds of inconsistencies.
I wanted to ask if the
2007 Apr 11
12
redirection doesn''t get detected well?
I''m doing a redirect in one of my controller actions and somehow I can''t
spec it, see this pastie: http://pastie.caboo.se/53120.
When following the link from a browser I''m being redirected to the right
page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: