Skip to content

Instantly share code, notes, and snippets.

@Evanto
Last active June 1, 2017 10:01
Show Gist options
  • Save Evanto/5734a8fc47eb8546b6abff3368783765 to your computer and use it in GitHub Desktop.
Save Evanto/5734a8fc47eb8546b6abff3368783765 to your computer and use it in GitHub Desktop.
ubuntu@rails-dev-box:~/www/qna$ rspec spec
F...FFFFFFFF.FF..FFFF..FFFFFFF..F.F.F...FF..FF
Failures:
1) Create question
In order to get answers from a community
as an authenticated user I want to be able to ask questions
Authenticated user creates a question
Failure/Error: expect(page).to have_content 'Your question was successfully created.'
expected to find text "Your question was successfully created." in "New QuestionTitleBody Test body"
# ./spec/acceptance/create_question_spec.rb:22:in `block (2 levels) in <top (required)>'
2) AnswersController GET #new assigns a new Answer to @answer
Failure/Error: let(:question) { create(:question) }
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/answers_controller_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:9:in `block (3 levels) in <top (required)>'
3) AnswersController GET #new checks that new answer corresponds to a question
Failure/Error: let(:question) { create(:question) }
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/answers_controller_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:9:in `block (3 levels) in <top (required)>'
4) AnswersController GET #new renders new view
Failure/Error: let(:question) { create(:question) }
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/answers_controller_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:9:in `block (3 levels) in <top (required)>'
5) AnswersController POST #create with valid attributes saves new answer to the db
Failure/Error: let(:question) { create(:question) }
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/answers_controller_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:27:in `block (4 levels) in <top (required)>'
6) AnswersController POST #create with valid attributes redirects to show view
Failure/Error: let(:question) { create(:question) }
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/answers_controller_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:31:in `block (4 levels) in <top (required)>'
7) AnswersController POST #create with invalid attributes does not save new anwser to db
Failure/Error: let(:question) { create(:question) }
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/answers_controller_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:39:in `block (5 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:39:in `block (4 levels) in <top (required)>'
8) AnswersController POST #create with invalid attributes re-renders new view
Failure/Error: let(:question) { create(:question) }
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/answers_controller_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/controllers/answers_controller_spec.rb:44:in `block (4 levels) in <top (required)>'
9) QuestionsController GET #index populates an array of all questions
Failure/Error: let(:questions) { create_list(:question, 2) } # синтаксис RSpec
ActiveModel::MissingAttributeError:
can't write unknown attribute `user_id`
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `public_send'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:16:in `block (2 levels) in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:15:in `block in object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `tap'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/attribute_assigner.rb:14:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/evaluation.rb:12:in `object'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy/create.rb:9:in `result'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory.rb:42:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:29:in `block in run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/factory_runner.rb:28:in `run'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:32:in `block (2 levels) in define_list_strategy_method'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:32:in `times'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:32:in `each'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:32:in `map'
# /var/lib/gems/2.4.0/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:32:in `block in define_list_strategy_method'
# ./spec/controllers/questions_controller_spec.rb:8:in `block (3 levels) in <top (required)>'
# ./spec/controllers/questions_controller_spec.rb:13:in `block (3 levels) in <top (required)>'
10) QuestionsController GET #show assigns the requested question to @question
Failure/Error: before { get :show, params: { id: question} }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::GETShow:0x00556811455758>
# ./spec/controllers/questions_controller_spec.rb:22:in `block (3 levels) in <top (required)>'
11) QuestionsController GET #show renders show view
Failure/Error: before { get :show, params: { id: question} }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::GETShow:0x0055681145d548>
# ./spec/controllers/questions_controller_spec.rb:22:in `block (3 levels) in <top (required)>'
12) QuestionsController GET #edit assign the requested question to @question
Failure/Error: before { get :edit, params: { id: question} }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::GETEdit:0x005568114cfc38>
# ./spec/controllers/questions_controller_spec.rb:50:in `block (3 levels) in <top (required)>'
13) QuestionsController GET #edit renders edit view
Failure/Error: before { get :edit, params: { id: question} }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::GETEdit:0x005568114e6190>
# ./spec/controllers/questions_controller_spec.rb:50:in `block (3 levels) in <top (required)>'
14) QuestionsController POST #create 1) with valid attributes saves the new question to the db
Failure/Error: expect { post :create, params: { question: attributes_for(:question) } }.to change(Question, :count).by(1)
expected #count to have changed by 1, but was changed by 0
# ./spec/controllers/questions_controller_spec.rb:66:in `block (4 levels) in <top (required)>'
15) QuestionsController POST #create 1) with valid attributes redirects to show view
Failure/Error: expect(response).to redirect_to (assigns(:question)) #
Expected response to be a <3XX: redirect>, but was a <200: OK>
Response body:
# ./spec/controllers/questions_controller_spec.rb:71:in `block (4 levels) in <top (required)>'
16) QuestionsController PATCH #update 1) valid attributes assigns the requested question to @question
Failure/Error: patch :update, params: { id: question, question: attributes_for(:question) }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::PATCHUpdate::Nested1ValidAttributes:0x00556811646f30>
# ./spec/controllers/questions_controller_spec.rb:92:in `block (4 levels) in <top (required)>'
17) QuestionsController PATCH #update 1) valid attributes changes question attributes
Failure/Error: patch :update, params: { id: question, question: { title: 'new title', body: 'new body' } } #cформировали хэш вручную
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::PATCHUpdate::Nested1ValidAttributes:0x0055681165d438>
# ./spec/controllers/questions_controller_spec.rb:97:in `block (4 levels) in <top (required)>'
18) QuestionsController PATCH #update 1) valid attributes redirects to the updated question
Failure/Error: patch :update, params: { id: question, question: attributes_for(:question) }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::PATCHUpdate::Nested1ValidAttributes:0x0055680f6c5c60>
# ./spec/controllers/questions_controller_spec.rb:105:in `block (4 levels) in <top (required)>'
19) QuestionsController PATCH #update 2) invalid attributes (params) does not change question attributes
Failure/Error: before { patch :update, params: { id: question, question: { title: 'new title', body: nil } } }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::PATCHUpdate::Nested2InvalidAttributesParams:0x00556811696260>
# ./spec/controllers/questions_controller_spec.rb:111:in `block (4 levels) in <top (required)>'
20) QuestionsController PATCH #update 2) invalid attributes (params) re-renders edit view
Failure/Error: before { patch :update, params: { id: question, question: { title: 'new title', body: nil } } }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::PATCHUpdate::Nested2InvalidAttributesParams:0x005568116a87f8>
# ./spec/controllers/questions_controller_spec.rb:111:in `block (4 levels) in <top (required)>'
21) QuestionsController DELETE #destroy deletes question
Failure/Error: before { question }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::DELETEDestroy:0x005568116caa60>
# ./spec/controllers/questions_controller_spec.rb:128:in `block (3 levels) in <top (required)>'
22) QuestionsController DELETE #destroy redirects to index view
Failure/Error: before { question }
NameError:
undefined local variable or method `question' for #<RSpec::ExampleGroups::QuestionsController::DELETEDestroy:0x005568116e0f40>
# ./spec/controllers/questions_controller_spec.rb:128:in `block (3 levels) in <top (required)>'
23) Answer should validate that :user_id cannot be empty/falsy
Failure/Error: it { should validate_presence_of :user_id }
Shoulda::Matchers::ActiveModel::AllowValueMatcher::AttributeDoesNotExistError:
The matcher attempted to set :user_id on the Answer to nil, but that
attribute does not exist.
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb:214:in `attribute_does_not_exist!'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb:78:in `set!'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:38:in `matches?'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:24:in `each'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:24:in `detect'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:24:in `first_passing'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher.rb:533:in `public_send'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher.rb:533:in `run'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/allow_value_matcher.rb:400:in `does_not_match?'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/disallow_value_matcher.rb:32:in `matches?'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/validation_matcher.rb:155:in `run_allow_or_disallow_matcher'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/validation_matcher.rb:93:in `disallows_value_of'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb:149:in `disallows_original_or_typecast_value?'
# /home/ubuntu/.bundle/ruby/2.4.0/shoulda-matchers-ead87017a6c1/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb:126:in `matches?'
# ./spec/models/answer_spec.rb:6:in `block (2 levels) in <top (required)>'
24) Answer should belong to user
Failure/Error: it { should belong_to(:user) }
Expected Answer to have a belongs_to association called user (Answer does not have a user_id foreign key.)
# ./spec/models/answer_spec.rb:8:in `block (2 levels) in <top (required)>'
25) Answer should have an index on columns user_id
Failure/Error: it { should have_db_index(:user_id) }
Expected Answer to have an index on columns user_id ()
# ./spec/models/answer_spec.rb:10:in `block (2 levels) in <top (required)>'
26) Question should belong to user
Failure/Error: it { should belong_to(:user) }
Expected Question to have a belongs_to association called user (Question does not have a user_id foreign key.)
# ./spec/models/question_spec.rb:7:in `block (2 levels) in <top (required)>'
27) Question should have an index on columns user_id
Failure/Error: it { should have_db_index(:user_id) }
Expected Question to have an index on columns user_id ()
# ./spec/models/question_spec.rb:8:in `block (2 levels) in <top (required)>'
28) User should have many questions
Failure/Error: it { should have_many(:questions) }
Expected User to have a has_many association called questions (Question does not have a user_id foreign key.)
# ./spec/models/user_spec.rb:6:in `block (2 levels) in <top (required)>'
29) User should have many answers
Failure/Error: it { should have_many(:answers) }
Expected User to have a has_many association called answers (Answer does not have a user_id foreign key.)
# ./spec/models/user_spec.rb:7:in `block (2 levels) in <top (required)>'
Finished in 1.11 seconds (files took 3.58 seconds to load)
46 examples, 29 failures
Failed examples:
rspec ./spec/acceptance/create_question_spec.rb:8 # Create question
In order to get answers from a community
as an authenticated user I want to be able to ask questions
Authenticated user creates a question
rspec ./spec/controllers/answers_controller_spec.rb:11 # AnswersController GET #new assigns a new Answer to @answer
rspec ./spec/controllers/answers_controller_spec.rb:15 # AnswersController GET #new checks that new answer corresponds to a question
rspec ./spec/controllers/answers_controller_spec.rb:19 # AnswersController GET #new renders new view
rspec ./spec/controllers/answers_controller_spec.rb:26 # AnswersController POST #create with valid attributes saves new answer to the db
rspec ./spec/controllers/answers_controller_spec.rb:30 # AnswersController POST #create with valid attributes redirects to show view
rspec ./spec/controllers/answers_controller_spec.rb:38 # AnswersController POST #create with invalid attributes does not save new anwser to db
rspec ./spec/controllers/answers_controller_spec.rb:43 # AnswersController POST #create with invalid attributes re-renders new view
rspec ./spec/controllers/questions_controller_spec.rb:12 # QuestionsController GET #index populates an array of all questions
rspec ./spec/controllers/questions_controller_spec.rb:24 # QuestionsController GET #show assigns the requested question to @question
rspec ./spec/controllers/questions_controller_spec.rb:28 # QuestionsController GET #show renders show view
rspec ./spec/controllers/questions_controller_spec.rb:52 # QuestionsController GET #edit assign the requested question to @question
rspec ./spec/controllers/questions_controller_spec.rb:56 # QuestionsController GET #edit renders edit view
rspec ./spec/controllers/questions_controller_spec.rb:65 # QuestionsController POST #create 1) with valid attributes saves the new question to the db
rspec ./spec/controllers/questions_controller_spec.rb:69 # QuestionsController POST #create 1) with valid attributes redirects to show view
rspec ./spec/controllers/questions_controller_spec.rb:91 # QuestionsController PATCH #update 1) valid attributes assigns the requested question to @question
rspec ./spec/controllers/questions_controller_spec.rb:96 # QuestionsController PATCH #update 1) valid attributes changes question attributes
rspec ./spec/controllers/questions_controller_spec.rb:104 # QuestionsController PATCH #update 1) valid attributes redirects to the updated question
rspec ./spec/controllers/questions_controller_spec.rb:113 # QuestionsController PATCH #update 2) invalid attributes (params) does not change question attributes
rspec ./spec/controllers/questions_controller_spec.rb:119 # QuestionsController PATCH #update 2) invalid attributes (params) re-renders edit view
rspec ./spec/controllers/questions_controller_spec.rb:129 # QuestionsController DELETE #destroy deletes question
rspec ./spec/controllers/questions_controller_spec.rb:133 # QuestionsController DELETE #destroy redirects to index view
rspec ./spec/models/answer_spec.rb:6 # Answer should validate that :user_id cannot be empty/falsy
rspec ./spec/models/answer_spec.rb:8 # Answer should belong to user
rspec ./spec/models/answer_spec.rb:10 # Answer should have an index on columns user_id
rspec ./spec/models/question_spec.rb:7 # Question should belong to user
rspec ./spec/models/question_spec.rb:8 # Question should have an index on columns user_id
rspec ./spec/models/user_spec.rb:6 # User should have many questions
rspec ./spec/models/user_spec.rb:7 # User should have many answers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment