add rspec scaffold tests and a test db environment

This commit is contained in:
Devin Howard 2015-10-12 11:37:44 +08:00
parent 16c47d75d4
commit 25117cf0e6
38 changed files with 1277 additions and 3 deletions

View file

@ -56,5 +56,9 @@ module Metamaps
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '2.0'
config.generators do |g|
g.test_framework :rspec
end
end
end

View file

@ -1,10 +1,17 @@
development:
defaults: &defaults
min_messages: WARNING
adapter: postgresql
host: 127.0.0.1
port: 5432
encoding: unicode
database: metamap002_development
pool: 5
username: postgres
password: "3112"
password: "3112"
development:
<<: *defaults
database: metamap002_development
test:
<<: *defaults
database: metamap002_test

View file

@ -13,6 +13,9 @@ Devise.setup do |config|
if Rails.env.development? # this is for Connors localhost
config.secret_key = 'f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73ee6c94675b62fe1f6d52fa7ba8196b33031f0d2f3b67e27ea07693c52ecebccb01700cad614'
end
if Rails.env.test?
config.secret_key = '81eb6e1c01efc2c78fde270d7c8233439488b20fac92bd08d0c1b02e98d2a32a7d603141e8ad7f7c01c24814bee81067074e17d868a0b1422df032af415be31c'
end
if Rails.env.production? # this is for the heroku staging environment
config.secret_key = 'd91ba0da95749174ee2b8922034783cbde4945409ed28b13383e18e72844beb74467f8199e9e216f0687cd2290c6e46bf74da24486d14bba3671d76c5b10c753'
end

View file

@ -0,0 +1,159 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
RSpec.describe MappingsController, :type => :controller do
# This should return the minimal set of attributes required to create a valid
# Mapping. As you add validations to Mapping, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# MappingsController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "assigns all mappings as @mappings" do
mapping = Mapping.create! valid_attributes
get :index, {}, valid_session
expect(assigns(:mappings)).to eq([mapping])
end
end
describe "GET #show" do
it "assigns the requested mapping as @mapping" do
mapping = Mapping.create! valid_attributes
get :show, {:id => mapping.to_param}, valid_session
expect(assigns(:mapping)).to eq(mapping)
end
end
describe "GET #new" do
it "assigns a new mapping as @mapping" do
get :new, {}, valid_session
expect(assigns(:mapping)).to be_a_new(Mapping)
end
end
describe "GET #edit" do
it "assigns the requested mapping as @mapping" do
mapping = Mapping.create! valid_attributes
get :edit, {:id => mapping.to_param}, valid_session
expect(assigns(:mapping)).to eq(mapping)
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Mapping" do
expect {
post :create, {:mapping => valid_attributes}, valid_session
}.to change(Mapping, :count).by(1)
end
it "assigns a newly created mapping as @mapping" do
post :create, {:mapping => valid_attributes}, valid_session
expect(assigns(:mapping)).to be_a(Mapping)
expect(assigns(:mapping)).to be_persisted
end
it "redirects to the created mapping" do
post :create, {:mapping => valid_attributes}, valid_session
expect(response).to redirect_to(Mapping.last)
end
end
context "with invalid params" do
it "assigns a newly created but unsaved mapping as @mapping" do
post :create, {:mapping => invalid_attributes}, valid_session
expect(assigns(:mapping)).to be_a_new(Mapping)
end
it "re-renders the 'new' template" do
post :create, {:mapping => invalid_attributes}, valid_session
expect(response).to render_template("new")
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested mapping" do
mapping = Mapping.create! valid_attributes
put :update, {:id => mapping.to_param, :mapping => new_attributes}, valid_session
mapping.reload
skip("Add assertions for updated state")
end
it "assigns the requested mapping as @mapping" do
mapping = Mapping.create! valid_attributes
put :update, {:id => mapping.to_param, :mapping => valid_attributes}, valid_session
expect(assigns(:mapping)).to eq(mapping)
end
it "redirects to the mapping" do
mapping = Mapping.create! valid_attributes
put :update, {:id => mapping.to_param, :mapping => valid_attributes}, valid_session
expect(response).to redirect_to(mapping)
end
end
context "with invalid params" do
it "assigns the mapping as @mapping" do
mapping = Mapping.create! valid_attributes
put :update, {:id => mapping.to_param, :mapping => invalid_attributes}, valid_session
expect(assigns(:mapping)).to eq(mapping)
end
it "re-renders the 'edit' template" do
mapping = Mapping.create! valid_attributes
put :update, {:id => mapping.to_param, :mapping => invalid_attributes}, valid_session
expect(response).to render_template("edit")
end
end
end
describe "DELETE #destroy" do
it "destroys the requested mapping" do
mapping = Mapping.create! valid_attributes
expect {
delete :destroy, {:id => mapping.to_param}, valid_session
}.to change(Mapping, :count).by(-1)
end
it "redirects to the mappings list" do
mapping = Mapping.create! valid_attributes
delete :destroy, {:id => mapping.to_param}, valid_session
expect(response).to redirect_to(mappings_url)
end
end
end

View file

@ -0,0 +1,159 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
RSpec.describe MapsController, :type => :controller do
# This should return the minimal set of attributes required to create a valid
# Map. As you add validations to Map, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# MapsController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "assigns all maps as @maps" do
map = Map.create! valid_attributes
get :index, {}, valid_session
expect(assigns(:maps)).to eq([map])
end
end
describe "GET #show" do
it "assigns the requested map as @map" do
map = Map.create! valid_attributes
get :show, {:id => map.to_param}, valid_session
expect(assigns(:map)).to eq(map)
end
end
describe "GET #new" do
it "assigns a new map as @map" do
get :new, {}, valid_session
expect(assigns(:map)).to be_a_new(Map)
end
end
describe "GET #edit" do
it "assigns the requested map as @map" do
map = Map.create! valid_attributes
get :edit, {:id => map.to_param}, valid_session
expect(assigns(:map)).to eq(map)
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Map" do
expect {
post :create, {:map => valid_attributes}, valid_session
}.to change(Map, :count).by(1)
end
it "assigns a newly created map as @map" do
post :create, {:map => valid_attributes}, valid_session
expect(assigns(:map)).to be_a(Map)
expect(assigns(:map)).to be_persisted
end
it "redirects to the created map" do
post :create, {:map => valid_attributes}, valid_session
expect(response).to redirect_to(Map.last)
end
end
context "with invalid params" do
it "assigns a newly created but unsaved map as @map" do
post :create, {:map => invalid_attributes}, valid_session
expect(assigns(:map)).to be_a_new(Map)
end
it "re-renders the 'new' template" do
post :create, {:map => invalid_attributes}, valid_session
expect(response).to render_template("new")
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested map" do
map = Map.create! valid_attributes
put :update, {:id => map.to_param, :map => new_attributes}, valid_session
map.reload
skip("Add assertions for updated state")
end
it "assigns the requested map as @map" do
map = Map.create! valid_attributes
put :update, {:id => map.to_param, :map => valid_attributes}, valid_session
expect(assigns(:map)).to eq(map)
end
it "redirects to the map" do
map = Map.create! valid_attributes
put :update, {:id => map.to_param, :map => valid_attributes}, valid_session
expect(response).to redirect_to(map)
end
end
context "with invalid params" do
it "assigns the map as @map" do
map = Map.create! valid_attributes
put :update, {:id => map.to_param, :map => invalid_attributes}, valid_session
expect(assigns(:map)).to eq(map)
end
it "re-renders the 'edit' template" do
map = Map.create! valid_attributes
put :update, {:id => map.to_param, :map => invalid_attributes}, valid_session
expect(response).to render_template("edit")
end
end
end
describe "DELETE #destroy" do
it "destroys the requested map" do
map = Map.create! valid_attributes
expect {
delete :destroy, {:id => map.to_param}, valid_session
}.to change(Map, :count).by(-1)
end
it "redirects to the maps list" do
map = Map.create! valid_attributes
delete :destroy, {:id => map.to_param}, valid_session
expect(response).to redirect_to(maps_url)
end
end
end

View file

@ -0,0 +1,159 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
RSpec.describe MetacodesController, :type => :controller do
# This should return the minimal set of attributes required to create a valid
# Metacode. As you add validations to Metacode, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# MetacodesController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "assigns all metacodes as @metacodes" do
metacode = Metacode.create! valid_attributes
get :index, {}, valid_session
expect(assigns(:metacodes)).to eq([metacode])
end
end
describe "GET #show" do
it "assigns the requested metacode as @metacode" do
metacode = Metacode.create! valid_attributes
get :show, {:id => metacode.to_param}, valid_session
expect(assigns(:metacode)).to eq(metacode)
end
end
describe "GET #new" do
it "assigns a new metacode as @metacode" do
get :new, {}, valid_session
expect(assigns(:metacode)).to be_a_new(Metacode)
end
end
describe "GET #edit" do
it "assigns the requested metacode as @metacode" do
metacode = Metacode.create! valid_attributes
get :edit, {:id => metacode.to_param}, valid_session
expect(assigns(:metacode)).to eq(metacode)
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Metacode" do
expect {
post :create, {:metacode => valid_attributes}, valid_session
}.to change(Metacode, :count).by(1)
end
it "assigns a newly created metacode as @metacode" do
post :create, {:metacode => valid_attributes}, valid_session
expect(assigns(:metacode)).to be_a(Metacode)
expect(assigns(:metacode)).to be_persisted
end
it "redirects to the created metacode" do
post :create, {:metacode => valid_attributes}, valid_session
expect(response).to redirect_to(Metacode.last)
end
end
context "with invalid params" do
it "assigns a newly created but unsaved metacode as @metacode" do
post :create, {:metacode => invalid_attributes}, valid_session
expect(assigns(:metacode)).to be_a_new(Metacode)
end
it "re-renders the 'new' template" do
post :create, {:metacode => invalid_attributes}, valid_session
expect(response).to render_template("new")
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested metacode" do
metacode = Metacode.create! valid_attributes
put :update, {:id => metacode.to_param, :metacode => new_attributes}, valid_session
metacode.reload
skip("Add assertions for updated state")
end
it "assigns the requested metacode as @metacode" do
metacode = Metacode.create! valid_attributes
put :update, {:id => metacode.to_param, :metacode => valid_attributes}, valid_session
expect(assigns(:metacode)).to eq(metacode)
end
it "redirects to the metacode" do
metacode = Metacode.create! valid_attributes
put :update, {:id => metacode.to_param, :metacode => valid_attributes}, valid_session
expect(response).to redirect_to(metacode)
end
end
context "with invalid params" do
it "assigns the metacode as @metacode" do
metacode = Metacode.create! valid_attributes
put :update, {:id => metacode.to_param, :metacode => invalid_attributes}, valid_session
expect(assigns(:metacode)).to eq(metacode)
end
it "re-renders the 'edit' template" do
metacode = Metacode.create! valid_attributes
put :update, {:id => metacode.to_param, :metacode => invalid_attributes}, valid_session
expect(response).to render_template("edit")
end
end
end
describe "DELETE #destroy" do
it "destroys the requested metacode" do
metacode = Metacode.create! valid_attributes
expect {
delete :destroy, {:id => metacode.to_param}, valid_session
}.to change(Metacode, :count).by(-1)
end
it "redirects to the metacodes list" do
metacode = Metacode.create! valid_attributes
delete :destroy, {:id => metacode.to_param}, valid_session
expect(response).to redirect_to(metacodes_url)
end
end
end

View file

@ -0,0 +1,159 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
RSpec.describe SynapsesController, :type => :controller do
# This should return the minimal set of attributes required to create a valid
# Synapse. As you add validations to Synapse, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# SynapsesController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "assigns all synapses as @synapses" do
synapse = Synapse.create! valid_attributes
get :index, {}, valid_session
expect(assigns(:synapses)).to eq([synapse])
end
end
describe "GET #show" do
it "assigns the requested synapse as @synapse" do
synapse = Synapse.create! valid_attributes
get :show, {:id => synapse.to_param}, valid_session
expect(assigns(:synapse)).to eq(synapse)
end
end
describe "GET #new" do
it "assigns a new synapse as @synapse" do
get :new, {}, valid_session
expect(assigns(:synapse)).to be_a_new(Synapse)
end
end
describe "GET #edit" do
it "assigns the requested synapse as @synapse" do
synapse = Synapse.create! valid_attributes
get :edit, {:id => synapse.to_param}, valid_session
expect(assigns(:synapse)).to eq(synapse)
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Synapse" do
expect {
post :create, {:synapse => valid_attributes}, valid_session
}.to change(Synapse, :count).by(1)
end
it "assigns a newly created synapse as @synapse" do
post :create, {:synapse => valid_attributes}, valid_session
expect(assigns(:synapse)).to be_a(Synapse)
expect(assigns(:synapse)).to be_persisted
end
it "redirects to the created synapse" do
post :create, {:synapse => valid_attributes}, valid_session
expect(response).to redirect_to(Synapse.last)
end
end
context "with invalid params" do
it "assigns a newly created but unsaved synapse as @synapse" do
post :create, {:synapse => invalid_attributes}, valid_session
expect(assigns(:synapse)).to be_a_new(Synapse)
end
it "re-renders the 'new' template" do
post :create, {:synapse => invalid_attributes}, valid_session
expect(response).to render_template("new")
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested synapse" do
synapse = Synapse.create! valid_attributes
put :update, {:id => synapse.to_param, :synapse => new_attributes}, valid_session
synapse.reload
skip("Add assertions for updated state")
end
it "assigns the requested synapse as @synapse" do
synapse = Synapse.create! valid_attributes
put :update, {:id => synapse.to_param, :synapse => valid_attributes}, valid_session
expect(assigns(:synapse)).to eq(synapse)
end
it "redirects to the synapse" do
synapse = Synapse.create! valid_attributes
put :update, {:id => synapse.to_param, :synapse => valid_attributes}, valid_session
expect(response).to redirect_to(synapse)
end
end
context "with invalid params" do
it "assigns the synapse as @synapse" do
synapse = Synapse.create! valid_attributes
put :update, {:id => synapse.to_param, :synapse => invalid_attributes}, valid_session
expect(assigns(:synapse)).to eq(synapse)
end
it "re-renders the 'edit' template" do
synapse = Synapse.create! valid_attributes
put :update, {:id => synapse.to_param, :synapse => invalid_attributes}, valid_session
expect(response).to render_template("edit")
end
end
end
describe "DELETE #destroy" do
it "destroys the requested synapse" do
synapse = Synapse.create! valid_attributes
expect {
delete :destroy, {:id => synapse.to_param}, valid_session
}.to change(Synapse, :count).by(-1)
end
it "redirects to the synapses list" do
synapse = Synapse.create! valid_attributes
delete :destroy, {:id => synapse.to_param}, valid_session
expect(response).to redirect_to(synapses_url)
end
end
end

View file

@ -0,0 +1,159 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
RSpec.describe TopicsController, :type => :controller do
# This should return the minimal set of attributes required to create a valid
# Topic. As you add validations to Topic, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# TopicsController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "assigns all topics as @topics" do
topic = Topic.create! valid_attributes
get :index, {}, valid_session
expect(assigns(:topics)).to eq([topic])
end
end
describe "GET #show" do
it "assigns the requested topic as @topic" do
topic = Topic.create! valid_attributes
get :show, {:id => topic.to_param}, valid_session
expect(assigns(:topic)).to eq(topic)
end
end
describe "GET #new" do
it "assigns a new topic as @topic" do
get :new, {}, valid_session
expect(assigns(:topic)).to be_a_new(Topic)
end
end
describe "GET #edit" do
it "assigns the requested topic as @topic" do
topic = Topic.create! valid_attributes
get :edit, {:id => topic.to_param}, valid_session
expect(assigns(:topic)).to eq(topic)
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Topic" do
expect {
post :create, {:topic => valid_attributes}, valid_session
}.to change(Topic, :count).by(1)
end
it "assigns a newly created topic as @topic" do
post :create, {:topic => valid_attributes}, valid_session
expect(assigns(:topic)).to be_a(Topic)
expect(assigns(:topic)).to be_persisted
end
it "redirects to the created topic" do
post :create, {:topic => valid_attributes}, valid_session
expect(response).to redirect_to(Topic.last)
end
end
context "with invalid params" do
it "assigns a newly created but unsaved topic as @topic" do
post :create, {:topic => invalid_attributes}, valid_session
expect(assigns(:topic)).to be_a_new(Topic)
end
it "re-renders the 'new' template" do
post :create, {:topic => invalid_attributes}, valid_session
expect(response).to render_template("new")
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested topic" do
topic = Topic.create! valid_attributes
put :update, {:id => topic.to_param, :topic => new_attributes}, valid_session
topic.reload
skip("Add assertions for updated state")
end
it "assigns the requested topic as @topic" do
topic = Topic.create! valid_attributes
put :update, {:id => topic.to_param, :topic => valid_attributes}, valid_session
expect(assigns(:topic)).to eq(topic)
end
it "redirects to the topic" do
topic = Topic.create! valid_attributes
put :update, {:id => topic.to_param, :topic => valid_attributes}, valid_session
expect(response).to redirect_to(topic)
end
end
context "with invalid params" do
it "assigns the topic as @topic" do
topic = Topic.create! valid_attributes
put :update, {:id => topic.to_param, :topic => invalid_attributes}, valid_session
expect(assigns(:topic)).to eq(topic)
end
it "re-renders the 'edit' template" do
topic = Topic.create! valid_attributes
put :update, {:id => topic.to_param, :topic => invalid_attributes}, valid_session
expect(response).to render_template("edit")
end
end
end
describe "DELETE #destroy" do
it "destroys the requested topic" do
topic = Topic.create! valid_attributes
expect {
delete :destroy, {:id => topic.to_param}, valid_session
}.to change(Topic, :count).by(-1)
end
it "redirects to the topics list" do
topic = Topic.create! valid_attributes
delete :destroy, {:id => topic.to_param}, valid_session
expect(response).to redirect_to(topics_url)
end
end
end

5
spec/models/map_spec.rb Normal file
View file

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Map, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View file

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Mapping, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View file

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Metacode, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View file

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Synapse, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View file

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Topic, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View file

@ -0,0 +1,35 @@
require "rails_helper"
RSpec.describe MappingsController, :type => :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/mappings").to route_to("mappings#index")
end
it "routes to #new" do
expect(:get => "/mappings/new").to route_to("mappings#new")
end
it "routes to #show" do
expect(:get => "/mappings/1").to route_to("mappings#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/mappings/1/edit").to route_to("mappings#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/mappings").to route_to("mappings#create")
end
it "routes to #update via PUT" do
expect(:put => "/mappings/1").to route_to("mappings#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/mappings/1").to route_to("mappings#destroy", :id => "1")
end
end
end

View file

@ -0,0 +1,35 @@
require "rails_helper"
RSpec.describe MapsController, :type => :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/maps").to route_to("maps#index")
end
it "routes to #new" do
expect(:get => "/maps/new").to route_to("maps#new")
end
it "routes to #show" do
expect(:get => "/maps/1").to route_to("maps#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/maps/1/edit").to route_to("maps#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/maps").to route_to("maps#create")
end
it "routes to #update via PUT" do
expect(:put => "/maps/1").to route_to("maps#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/maps/1").to route_to("maps#destroy", :id => "1")
end
end
end

View file

@ -0,0 +1,35 @@
require "rails_helper"
RSpec.describe MetacodesController, :type => :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/metacodes").to route_to("metacodes#index")
end
it "routes to #new" do
expect(:get => "/metacodes/new").to route_to("metacodes#new")
end
it "routes to #show" do
expect(:get => "/metacodes/1").to route_to("metacodes#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/metacodes/1/edit").to route_to("metacodes#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/metacodes").to route_to("metacodes#create")
end
it "routes to #update via PUT" do
expect(:put => "/metacodes/1").to route_to("metacodes#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/metacodes/1").to route_to("metacodes#destroy", :id => "1")
end
end
end

View file

@ -0,0 +1,35 @@
require "rails_helper"
RSpec.describe SynapsesController, :type => :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/synapses").to route_to("synapses#index")
end
it "routes to #new" do
expect(:get => "/synapses/new").to route_to("synapses#new")
end
it "routes to #show" do
expect(:get => "/synapses/1").to route_to("synapses#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/synapses/1/edit").to route_to("synapses#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/synapses").to route_to("synapses#create")
end
it "routes to #update via PUT" do
expect(:put => "/synapses/1").to route_to("synapses#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/synapses/1").to route_to("synapses#destroy", :id => "1")
end
end
end

View file

@ -0,0 +1,35 @@
require "rails_helper"
RSpec.describe TopicsController, :type => :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/topics").to route_to("topics#index")
end
it "routes to #new" do
expect(:get => "/topics/new").to route_to("topics#new")
end
it "routes to #show" do
expect(:get => "/topics/1").to route_to("topics#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/topics/1/edit").to route_to("topics#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/topics").to route_to("topics#create")
end
it "routes to #update via PUT" do
expect(:put => "/topics/1").to route_to("topics#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/topics/1").to route_to("topics#destroy", :id => "1")
end
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "mappings/edit", :type => :view do
before(:each) do
@mapping = assign(:mapping, Mapping.create!())
end
it "renders the edit mapping form" do
render
assert_select "form[action=?][method=?]", mapping_path(@mapping), "post" do
end
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "mappings/index", :type => :view do
before(:each) do
assign(:mappings, [
Mapping.create!(),
Mapping.create!()
])
end
it "renders a list of mappings" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "mappings/new", :type => :view do
before(:each) do
assign(:mapping, Mapping.new())
end
it "renders new mapping form" do
render
assert_select "form[action=?][method=?]", mappings_path, "post" do
end
end
end

View file

@ -0,0 +1,11 @@
require 'rails_helper'
RSpec.describe "mappings/show", :type => :view do
before(:each) do
@mapping = assign(:mapping, Mapping.create!())
end
it "renders attributes in <p>" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "maps/edit", :type => :view do
before(:each) do
@map = assign(:map, Map.create!())
end
it "renders the edit map form" do
render
assert_select "form[action=?][method=?]", map_path(@map), "post" do
end
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "maps/index", :type => :view do
before(:each) do
assign(:maps, [
Map.create!(),
Map.create!()
])
end
it "renders a list of maps" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "maps/new", :type => :view do
before(:each) do
assign(:map, Map.new())
end
it "renders new map form" do
render
assert_select "form[action=?][method=?]", maps_path, "post" do
end
end
end

View file

@ -0,0 +1,11 @@
require 'rails_helper'
RSpec.describe "maps/show", :type => :view do
before(:each) do
@map = assign(:map, Map.create!())
end
it "renders attributes in <p>" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "metacodes/edit", :type => :view do
before(:each) do
@metacode = assign(:metacode, Metacode.create!())
end
it "renders the edit metacode form" do
render
assert_select "form[action=?][method=?]", metacode_path(@metacode), "post" do
end
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "metacodes/index", :type => :view do
before(:each) do
assign(:metacodes, [
Metacode.create!(),
Metacode.create!()
])
end
it "renders a list of metacodes" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "metacodes/new", :type => :view do
before(:each) do
assign(:metacode, Metacode.new())
end
it "renders new metacode form" do
render
assert_select "form[action=?][method=?]", metacodes_path, "post" do
end
end
end

View file

@ -0,0 +1,11 @@
require 'rails_helper'
RSpec.describe "metacodes/show", :type => :view do
before(:each) do
@metacode = assign(:metacode, Metacode.create!())
end
it "renders attributes in <p>" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "synapses/edit", :type => :view do
before(:each) do
@synapse = assign(:synapse, Synapse.create!())
end
it "renders the edit synapse form" do
render
assert_select "form[action=?][method=?]", synapse_path(@synapse), "post" do
end
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "synapses/index", :type => :view do
before(:each) do
assign(:synapses, [
Synapse.create!(),
Synapse.create!()
])
end
it "renders a list of synapses" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "synapses/new", :type => :view do
before(:each) do
assign(:synapse, Synapse.new())
end
it "renders new synapse form" do
render
assert_select "form[action=?][method=?]", synapses_path, "post" do
end
end
end

View file

@ -0,0 +1,11 @@
require 'rails_helper'
RSpec.describe "synapses/show", :type => :view do
before(:each) do
@synapse = assign(:synapse, Synapse.create!())
end
it "renders attributes in <p>" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "topics/edit", :type => :view do
before(:each) do
@topic = assign(:topic, Topic.create!())
end
it "renders the edit topic form" do
render
assert_select "form[action=?][method=?]", topic_path(@topic), "post" do
end
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "topics/index", :type => :view do
before(:each) do
assign(:topics, [
Topic.create!(),
Topic.create!()
])
end
it "renders a list of topics" do
render
end
end

View file

@ -0,0 +1,14 @@
require 'rails_helper'
RSpec.describe "topics/new", :type => :view do
before(:each) do
assign(:topic, Topic.new())
end
it "renders new topic form" do
render
assert_select "form[action=?][method=?]", topics_path, "post" do
end
end
end

View file

@ -0,0 +1,11 @@
require 'rails_helper'
RSpec.describe "topics/show", :type => :view do
before(:each) do
@topic = assign(:topic, Topic.create!())
end
it "renders attributes in <p>" do
render
end
end