-
-
Save tubbo/6f30d47a94763612b909a688bbd5b2b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The error message | |
undefined method `comments_path' for #<#<Class:0x007f01f0513be8>:0x00000003b43928> | |
Did you mean? font_path | |
Extracted source (around line #1): | |
1 | |
2 | |
3 | |
4 | |
5 | |
<%= simple_form_for([@topic, @comment]) do |f| %> | |
<%= f.input :text %> | |
<%= f.button :submit, class: "new btn-primary" %> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The routes, in case there is something wrong here. | |
Rails.application.routes.draw do | |
root 'forums#index' | |
namespace :admin do | |
resources :users | |
root 'application#index' | |
get '/admin/forums' => "forums#index" | |
resources :forums | |
end | |
devise_for :users | |
resources :forums, only: [:show, :index] do | |
resources :topics do | |
resources :comments, only: [:create, :new, :destroy, :edit] | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The test that is failing | |
require 'rails_helper' | |
RSpec.describe "Users can leave comments" do | |
let(:user) { FactoryGirl.create(:user) } | |
let(:topic) { FactoryGirl.create(:topic, author: user, forum: forum) } | |
let(:forum) { FactoryGirl.create(:forum) } | |
before do | |
login_as(user) | |
visit forum_topic_path(forum, topic) | |
end | |
scenario 'with valid attributes' do | |
click_link "Add Comment" | |
fill_in "Text", with: "This is some random text for a comment" | |
click_button "Create Comment" | |
expect(page).to have_content "Comment has been created." | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment