Skip to content

Instantly share code, notes, and snippets.

$ rspec spec/models/article_spec.rb
F
Failures:
1) Article.published only returns published articles
Failure/Error: @published.should_not be_empty
NoMethodError:
undefined method `empty?' for nil:NilClass
# ./spec/models/article_spec.rb:13:in `block (3 levels) in <top
class Article < ActiveRecord::Base
def self.published
end
end
$ rspec spec/models/article_spec.rb
F
Failures:
1) Article.published only returns published articles
Failure/Error: @published = Article.published
NoMethodError:
undefined method `published' for #<Class:0x007fee85f72440>
# ./spec/models/article_spec.rb:9:in `block (3 levels) in <top
require 'spec_helper'
describe Article do
describe '.published' do
before do
FactoryGirl.create_list(:published_article, 2)
FactoryGirl.create_list(:unpublished_article, 1)
@published = Article.published
end
$ cucumber features/api/v1/articles.feature
Using the default profile...
..F-
(::) failed steps (::)
undefined method `published' for #<Class:0x007ff13c529498>
(NoMethodError)
./app/controllers/api/v1/articles_controller.rb:3:in `index'
./features/step_definitions/api/v1/articles_steps.rb:11:in `/^I ask for
class Api::V1::ArticlesController < ApplicationController
def index
@articles = Article.published
end
end
$ cucumber features/api/v1/articles.feature
Using the default profile...
..F-
(::) failed steps (::)
undefined method `empty?' for nil:NilClass (ActionView::Template::Error)
Failing Scenarios:
cucumber features/api/v1/articles.feature:6 # Scenario: Get articles
json.array! @articles do |json, article|
json.title article.title
end
$ touch app/views/api/v1/articles/index.json.jbuilder
$ cucumber features/api/v1/articles.feature
Using the default profile...
...F
(::) failed steps (::)
expected 3 published_articles, got 0
(RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/api/v1/articles_steps.rb:16:in `/^I should
$ cucumber features/api/v1/articles.feature
Using the default profile...
..F-
(::) failed steps (::)
Missing template api/v1/articles/index, application/index with
{:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder,
:jbuilder, :coffee]}. Searched in:
* "/Users/jared/Projects/sample/app/views"