comments
This commit is contained in:
6
spec/factories/comments.rb
Normal file
6
spec/factories/comments.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :comment do
|
||||
end
|
||||
end
|
||||
15
spec/helpers/comments_helper_spec.rb
Normal file
15
spec/helpers/comments_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the CommentsHelper. For example:
|
||||
#
|
||||
# describe CommentsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
describe CommentsHelper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/comment_spec.rb
Normal file
5
spec/models/comment_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Comment do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
11
spec/requests/comments_spec.rb
Normal file
11
spec/requests/comments_spec.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Comments" do
|
||||
describe "GET /comments" do
|
||||
it "works! (now write some real specs)" do
|
||||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
|
||||
get comments_path
|
||||
response.status.should be(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
35
spec/routing/comments_routing_spec.rb
Normal file
35
spec/routing/comments_routing_spec.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe CommentsController do
|
||||
describe "routing" do
|
||||
|
||||
it "routes to #index" do
|
||||
get("/comments").should route_to("comments#index")
|
||||
end
|
||||
|
||||
it "routes to #new" do
|
||||
get("/comments/new").should route_to("comments#new")
|
||||
end
|
||||
|
||||
it "routes to #show" do
|
||||
get("/comments/1").should route_to("comments#show", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #edit" do
|
||||
get("/comments/1/edit").should route_to("comments#edit", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #create" do
|
||||
post("/comments").should route_to("comments#create")
|
||||
end
|
||||
|
||||
it "routes to #update" do
|
||||
put("/comments/1").should route_to("comments#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #destroy" do
|
||||
delete("/comments/1").should route_to("comments#destroy", :id => "1")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
15
spec/views/comments/edit.html.erb_spec.rb
Normal file
15
spec/views/comments/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "comments/edit" do
|
||||
before(:each) do
|
||||
@comment = assign(:comment, stub_model(Comment))
|
||||
end
|
||||
|
||||
it "renders the edit comment form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form[action=?][method=?]", comment_path(@comment), "post" do
|
||||
end
|
||||
end
|
||||
end
|
||||
15
spec/views/comments/index.html.erb_spec.rb
Normal file
15
spec/views/comments/index.html.erb_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "comments/index" do
|
||||
before(:each) do
|
||||
assign(:comments, [
|
||||
stub_model(Comment),
|
||||
stub_model(Comment)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of comments" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
end
|
||||
end
|
||||
15
spec/views/comments/new.html.erb_spec.rb
Normal file
15
spec/views/comments/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "comments/new" do
|
||||
before(:each) do
|
||||
assign(:comment, stub_model(Comment).as_new_record)
|
||||
end
|
||||
|
||||
it "renders new comment form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form[action=?][method=?]", comments_path, "post" do
|
||||
end
|
||||
end
|
||||
end
|
||||
12
spec/views/comments/show.html.erb_spec.rb
Normal file
12
spec/views/comments/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "comments/show" do
|
||||
before(:each) do
|
||||
@comment = assign(:comment, stub_model(Comment))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user