Displaying 20 results from an estimated 5000 matches similar to: "View specs - best practices"
2012 Jan 15
1
NoMethodError: undefined method `expect'
Ideas?
ruby-1.9.2-p290 :002 > require ''rspec''
=> true
ruby-1.9.2-p290 :003 > RSpec::Version::STRING
=> "2.8.0"
ruby-1.9.2-p290 :004 > describe ''division by zero'' do
ruby-1.9.2-p290 :005 > expect { 2/0 }.to raise_error
ruby-1.9.2-p290 :006?> end
NoMethodError: undefined method `expect'' for
2008 Oct 18
4
Problems when programmatically defining examples
Hi,
I am trying to code an application that is based on Rspec; I am
programmatically building examples, and launching the runner with a custom
formatter. Here are the code snippets from my app:
Launching the runner:
example_groups =
test_expectation.example_groups_for(system_state)
@output = StringIO.new
options =
2008 Jul 08
1
Strange behaviour with pending specs and implementation_backtrace
Hi all,
I''m using my own OutputFormatter with /bin/spec to catch rspec results. I''m experiencing strange behaviour with pending specs and implementation_backtrace.
This is my example_pending implementation in rspactor_formatter.rb:
class RSpactorFormatter
def example_pending(example, message)
spec = SpecObject.new(
:name => example.description,
2012 Sep 18
4
"best practices" for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.
I''ve been writing a gem to implement and extend common controller
functionality so that Rails can be used with Javascript frameworks like
AngularJS (which we are using), Ember.js, etc. in such a way that the user
doesn''t have to tweak a a bunch of rails g controller boilerplate code to
provide services for use in these frameworks that in turn would require
various changes to
2012 Oct 26
8
Puppet 3.0 rspec and custom resources
I am trying to figure out if I am missing something simple here. After
upgrading to puppet 3.0 running puppet-rspec tests that use
custom resources from modules in the fixtures directory are failing. I
have a module that uses the anchor type and with 2.7.19 it works fine.
After upgrading to 3.0 all of the tests are failing with
Puppet::Error:
Puppet::Parser::AST::Resource failed with
2011 Jan 02
3
undefined method `run_all' for :Array
I''m using the latest ruby 1.9.3-head and recently whenever I run rspec
(2.2+) I get the following error:
I have seen others have run into this issue, but to resolve it just
rolled back to a previous version of rspec or it there a better way?
ruby-1.9.3-head/gems/rspec-core-2.3.1/lib/rspec/core/hooks.rb:116:in
`run_hook_filtered'': undefined method `run_all'' for []:Array
2011 Jan 11
9
Can I omit respond_with.
If I don''t want xml results but only html can I omit respond_with in
some actions?
For example index from:
respond_with(@sectors = Sector.all)
becomes only
@sectors = Sector.all
isn''t it?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2010 Dec 23
6
Difference between rake test:units and individually running ruby -I test test/unit/something_test.rb ?
Here''s my issue: running ruby -I test test/unit/something_test.rb for
each of my unit tests works perfectly.
However, running rake test:units brings errors in all of them - some
object becomes nil for some reason.
Why might this be happening?
Specifics: the object that is successfully not nil when I run the unit
tests one-by-one but becomes nil when I do rake test:units is defined
like
2013 May 23
1
problem of respond_with working on nested resources
hi all:
when using namespace or nested resources in routes.rb,such as
"namespace :admin { resources :books }, we can use [:admin,@book] way to
generate path. It works fine in form_for , but when I use it with
respond_with in controller, I get problems.
The problem is when I put following code in controller:
def create
@book=Book.find(params[:id])
2013 Sep 26
2
Login Problem
Hello All,
I am getting a problem while login for inactive users.
While login I am getting -
Processing by Devise::SessionsController#new as HTML
User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = 2
LIMIT 1
Redirected to http://localhost:3000/
Filter chain halted as :require_no_authentication rendered or redirected.
Inactive users
2006 Mar 31
2
Backslash Escaping in View
Ok, I''m hoping this won''t be a forehead slapper, but take a look at this code:
physician.name.sub(/''/, "\\''")
I''m trying to substitute a single quote with a backslash and a single
quote. This seems pretty simple right? Well, someone kick me and
tell me why it''s not :)
Here''s what I''m getting if the
2013 Mar 28
0
Dude, where's my full description? (bug report & suggested fix in rspec-core 2.13.1)
Greetings,
I''m writing to report an issue I stumbled upon while trying to adjust to
the new (for me) world of implicit-subject expectation writing.
Consider this rather silly test case:
describe "something" do
context "in context" do
subject { "an object" }
it { should == "an object" }
end
end
When I run rspec with `--format
2010 Aug 11
6
rspec2 not working with shoulda
I am using rails edge. I am using gem "rspec-rails", "= 2.0.0.beta.
19" .
I have following code at spec/models/user_spec.rb
require ''spec_helper''
describe User do
it { should validate_presence_of(:email) }
it { should validate_presence_of(:name) }
end
Here is my gemfile
group :development, :test do
gem ''factory_girl_rails'',
2011 Jan 15
3
respond_with javascript
My ajax stopped working when I switched to using respond_with. For my
Votes, I have the create action and the corresponding create.js.erb,
and respond_to :html, :js, :xml in the controller. Heres the log when
I try and create a vote:
Started POST "/stories/3-asdfasdf1111/votes" for 127.0.0.1 at Fri Jan
14 20:46:36 -0800 2011
Processing by VotesController#create as */*
Parameters:
2010 Dec 22
8
Shoulda issue: no more "should have_instance_methods" ?
I''m using Shoulda.
After copying the code here....
.... http://joshuaclayton.github.com/code/2009/07/14/should-act-as-list.html....
into my test_helper file so I can test acts_as_list, I came across
issues. For one I realized I had to get rid of the _ between the
"should" and "have" in past cases, but here, I get this error when I
run my unit test:
2009 Jun 07
6
Missing Template when testing with the Brain Buster Captcha partial
When I run my functional tests, they throw an error with the following
message:
ActionView::TemplateError: Missing template /_captcha.erb in view path
app/views:test/vendor/plugins/brain_buster/views/brain_busters
On line #23 of app/views/contacts/_form.html.erb
20: <%= f.label :message %><br />
21: <%= f.text_area :message %>
22:
2011 Mar 01
11
Did rails or shoulda go insane on the inflection of 'taxes'?
I have a model ''xp_jurisdiction_taxes'' which rails (3) created correctly.
Another model ''xp_jurisdiction_states'' has many :xp_jurisdiction_taxes.
In my spec I am using a shoulda helper to test the association but get the
following error. BTW, greped the whole project just in case and the string
''taxi'' exists nowhere.
1)
2011 Jul 28
2
RSpec, shoulda-matchers and Rails model attributes validations
I was trying out RSpec framework in a project and got stopped doing the unit
test of a model. In particular, doing the test for the associations and the
ActiveRecord validations.
I started writing the validations but my tests didn''t look DRY at all.
Before refactoring the tests checked out and look for other people
solutions.
I found out shoulda-matchers and Shoulda (which if I
2010 Jun 15
8
Allow blank on should validate_uniqueness_of
Hello,
Using shoulda, any ideas how to allow blank when having this test:
should validate_uniqueness_of(:email)
Thanks.
--
J. Pablo Fernández <pupeno-GAtDADarczzQT0dZR+AlfA@public.gmane.org> (http://pupeno.com)
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2009 Apr 22
15
Why RSpec?
I like Shoulda. Sometimes I like plain old Test::Unit. Cucumber
gives me a different thought process.
I''d just like to hear some thoughts on why RSpec? What does it buy me
that I can''t get with Shoulda? I just can''t seem to think in RSpec.
Where is there a good example of RSpec tests that will help me grasp
the right path?
Thanks!
--
Amos King