I'm trying to add some commit hooks to my git repo. I want to leverage Rspec and create commit message specs that will run each time I commit. I have figured out how to run rspec outside of the 'spec' command, but I now have an interesting problem.
Here is my current code:
.git/hooks/commit-msg
#!/usr/bin/env ruby
require 'rubygems'
...
Hi.
I am using Cucumber as the BDD framework with rspec/mocha mocking. Ideally we would not mock/stub behavior in cucumber specs; however the scenario is exceptional here. To give you the brief idea of problem here; I have two features product feature and cart feature.
Cart feature is currently mocking some of the product fetch from 3 ...
I have a Picture model in my app that uses Paperclip to attach an image to it.
The model:
class Picture < ActiveRecord::Base
has_attached_file :image, :default_url => "/system/:attachment/missing.png", :styles => { :small => "100x100#", :medium => "460x460>", :large => "1024x1024>" }
validates_attachment_presence :image
validate...
I'm playing with cucumber but for some reason the features and scenarios are not being outputted to the console.
When I run
cucumber features
I get
Using the default profile...
....
1 scenario (1 passed)
4 steps (4 passed)
0m0.071s
So my tests have passed but I can't see my features or scenarios. Is there a command line flag or s...
I ask this because typing spec returns this error..
..ruby-1.9.2-head/lib/ruby/site_ruby/1.9.1/rubygems.rb:335:in `bin_path': can't find executable spec for rspec-2.0.0.beta.17 (Gem::Exception)
But 'rspec' seems to work.
...
I'm trying to do some scripted GUI testing in Windows using Ruby. I'm leveraging the guidance of a pragprog book and I'm hitting a bit of a snag. I've factored out some code to help with the repeatitive mapping of win32api functions. The code is as follows:
module WindowsGui
def self.def_api(function, parameters, return_value) ...
I have this example:
# GET New
context "on get to new" do
it "should assign cardset" do
@profile.cardsets.expects(:build).once.returns(Factory.stub(:cardset))
get :new
assigns[:cardset].should_not be_nil
end
end
To test this method:
# GET /cardsets/new
def new
@cardset = current_user.cardsets.build
end
I am trying...
I'm posting this because it took me forever to find the answer, because the search terms didn't match what I expected. Just trying to help out the next guy:
spec has been renamed to rspec
Credit: http://stackoverflow.com/users/377631/jasonpgignac for supplying the answer in another thread.
...
When I added my first gem dependency to config/environment.rb, (will_paginate), I'm encountering an error when running rspec as follows:
nik$ spec spec/
Missing these required gems:
will_paginate
You're running:
ruby 1.8.6.369 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
rubygems 1.3.7 at /Users/nik/.g...
I have a simple spec test in my Ruby on Rails application:
stub.instance_of(Search).x { 3 }
puts Search.new.x # displays 3
puts Search.first.x # gives me an error: undefined method `x' for #<Search:0xb5fabaa8>
why does the third line fail? Search.first does return an instance of Search.
Thanks
...
I've been assigned the task of creating an XSLT transform on an XML dump from a database. Being a believer of Test/Behavior Driven Development I was wondering if anyone has attempted it before or has advice about how to go about it.
My gut reaction is to test this 'black box' with rspec. Is there a unit testing framework out there f...
I can't get rSpec installed for Rails 3.
I'm running Ruby -v=1.8.7, Rails -v=3.0.0.beta4
So far I have..
git clone git://github.com/indirect/rails3-generators.git lib/generators
My GemFile :
group :test do
gem 'rspec'
gem 'rspec-rails'
gem "factory_girl"
gem 'cucumber-rails'
end
I ran :
bundle install
Then :
...
Hello,
I need to use the functionality of params_from, which was deprecated. Now route_to combines behavior of params_from and route_for. But I do not want to test that the route generates the path, because it does not and this is intentional (for backward compatability in old emails, I need to "alias" old path to the correct controller...
Hi,
What is the current trend for testing models in a Rails3+DataMapper application. I want to use RSpec but sorely miss the concise testing provided by shoulda macros. Question - Is there a way of getting the best of both worlds, ie. a nice dsl for testing and the brevity of shoulda macros, which can be used to test datamapper models.
...
I mostly followed these instructions to get things spun up:
http://lindsaar.net/2010/5/9/Getting-Rails-3-Edge-with-jQuery-RSpec-and-Cucumber-using-RVM
If I create a completely blank .feature file, running cucumber results in this error:
cucumber
wrong number of arguments (3 for 1)
(ArgumentError)
/gems/gherkin-2.0.2/lib/ghe...
Hi,
How can I debug rspec specs with an IDE? specifically I'm using the following:
* Ubuntu 10.04
* ruby 1.9.2-dev built with rvm
* rails3-beta4
* NetBeans 6.9
I have installed the ruby-debug19 and the ruby-debug-ide91 gems, but NetBeans doesn't recognize my fast-debugger. Besides trying to debug a spec in NetBeans gives the follow...
In RSpec, what's the difference between using should == ... and should eql(...)? I noticed that the RSpec documentation always uses eql, but == is less typing and easier to read. What am I missing?
...
I just changed my Rails 2.3.8 project to load gems using Bundler, rather than the default Rails 2.3 loading mechanism. I followed the official instructions and the site runs fine in development. I use RVM for gem management, and have a specific gemset loaded for the application.
My RSpec test suite is unable to run, however. I have trie...
I am trying to install rspec-rails on Ubuntu but I am encountering some problems.
Here are my exact steps:
1) Changed my Gemfile to:
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta4'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.0.0.beta.17'
end
group :test do
gem 'rspec', ...
I have seen a lot of outdated podcasts that mention mocha as a gem I would want to install because it does mocking better then rspec. I have a feeling that the rspec developers have caught on to this and have improved their mocking since then. However, in the default spec_helper.rb file I see some commented out code stubs for three mocki...