RSpec:: Core:: RakeTask.new(:spec)
task :default => [:spec]
Bootstrap the project with RSpec:
bash $ rspec --init
require 'aruba' require 'aruba/api'
include Aruba:: Api
This pulls in just the API helper methods in the Aruba:: Api namespace. These are what we'll be using to run commands, test outputs, and inspect files. The include …
/ for testing
Skinny models, controllers, and a service layer
But his metaphor breaks down a little, because the second stack isn't really a stack:
A considerable minority uses a stack like this. It's important that the Stack isn't exact: you might not use Cucumber at all, for example, or maybe you don't have a service layer.
On the (private, but cheap) Ruby , I came up with … "Parley" email list
Thank you Nicholas Marriott for making it easier to manage various terminals with …
My Rspec specs suddenly stopped working with the following error: Failure/Error: Unable to find matching line from backtrace DRb::DRbConnError: druby://127.0.0.1:8989 - #
Oddly, the first two tests were working, then the rest exploded. Turns out the culprit was raising an exception in the initialize() method of the class being tested, like so: def initialize( account ) raise if !account.kind_of?( UserAccount ) ... end
The first two tests tested the exception state, like …
We can add words like " RSpec" or "thoughtbot" to the spellfile (just a list of correctly-spelled words, not a list of magical incantations) by cursoring over those words in a file and typing: zg
If you found this useful, you might also enjoy:
…valores diferntes dependendo da localização escolhida atualmente. If we would add an Rspec spec to cover this behavior, it would look like this: describe Article do before(:each) do I18n.locale = :en @ article = Article.create title: "Hello World", body: "Test" I18n.locale = :"pt-BR" @article.update_attributes(title: "Ola Mundo", body: "Teste") end
context "translations" do it …
Human Testing: sometimes nothing beats enlisting the help of others to pound away on our beloved projects. You'd be surprised by how many issues are found by this approach, often leading to cries of, "But users aren't supposed to do that!"
Non-technical users: enlist someone who can has a hard time finding the / key. This type of …
Add the following to the Gemfile gem "mongoid", git: 'git://github.com/mongoid/mongoid.git' gem "omniauth-twitter" gem "figaro" # key configuration using ENV
Now some auto-code generation for quick setup: rails g mongoid:config # create …
The generated spec/spec_helper.rb sets config.order = "random" so that specs run in random order by default.
rename render_template to have_rendered (and alias to render_template for backward compatibility)
"uninitialized constant" errors are avoided when using using gems like rspec-rails-uncommitted that define:: before rspec-rails loads ( )
Score +2 if you write tests ( UnitTest, RSpec, or some other test driven framework)
Score -2 if you do not routinely use a testing framework.
Score +1 if you use source control extensively. Bonus +1 if you use git.
Score +2 for being very comfortable working in an *nix / linux environment.
Score +2 if you have created an API for a production …