Network and first signature collection prototyping
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
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.
|
||||
#
|
||||
# Also compared to earlier versions of this generator, there are no longer any
|
||||
# expectations of assigns and templates rendered. These features have been
|
||||
# removed from Rails core in Rails 5, but can be added back in via the
|
||||
# `rails-controller-testing` gem.
|
||||
|
||||
RSpec.describe Network::SignatureCollectionsController, type: :controller do
|
||||
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# Network::SignatureCollection. As you add validations to Network::SignatureCollection, 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
|
||||
# Network::SignatureCollectionsController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe "GET #index" do
|
||||
it "returns a success response" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
get :index, {}, valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns a success response" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
get :show, {:id => signature_collection.to_param}, valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #new" do
|
||||
it "returns a success response" do
|
||||
get :new, {}, valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #edit" do
|
||||
it "returns a success response" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
get :edit, {:id => signature_collection.to_param}, valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST #create" do
|
||||
context "with valid params" do
|
||||
it "creates a new Network::SignatureCollection" do
|
||||
expect {
|
||||
post :create, {:network_signature_collection => valid_attributes}, valid_session
|
||||
}.to change(Network::SignatureCollection, :count).by(1)
|
||||
end
|
||||
|
||||
it "redirects to the created network_signature_collection" do
|
||||
post :create, {:network_signature_collection => valid_attributes}, valid_session
|
||||
expect(response).to redirect_to(Network::SignatureCollection.last)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'new' template)" do
|
||||
post :create, {:network_signature_collection => invalid_attributes}, valid_session
|
||||
expect(response).to be_success
|
||||
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 network_signature_collection" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
put :update, {:id => signature_collection.to_param, :network_signature_collection => new_attributes}, valid_session
|
||||
signature_collection.reload
|
||||
skip("Add assertions for updated state")
|
||||
end
|
||||
|
||||
it "redirects to the network_signature_collection" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
put :update, {:id => signature_collection.to_param, :network_signature_collection => valid_attributes}, valid_session
|
||||
expect(response).to redirect_to(signature_collection)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
put :update, {:id => signature_collection.to_param, :network_signature_collection => invalid_attributes}, valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE #destroy" do
|
||||
it "destroys the requested network_signature_collection" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, {:id => signature_collection.to_param}, valid_session
|
||||
}.to change(Network::SignatureCollection, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the network_signature_collections list" do
|
||||
signature_collection = Network::SignatureCollection.create! valid_attributes
|
||||
delete :destroy, {:id => signature_collection.to_param}, valid_session
|
||||
expect(response).to redirect_to(network_signature_collections_url)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Network::SignatureCollectionsHelper. For example:
|
||||
#
|
||||
# describe Network::SignatureCollectionsHelper 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
|
||||
RSpec.describe Network::SignatureCollectionsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Network::SignatureCollection, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Network::SignatureCollections", type: :request do
|
||||
describe "GET /network_signature_collections" do
|
||||
it "works! (now write some real specs)" do
|
||||
get network_signature_collections_path
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Network::SignatureCollectionsController, type: :routing do
|
||||
describe "routing" do
|
||||
|
||||
it "routes to #index" do
|
||||
expect(:get => "/network/signature_collections").to route_to("network/signature_collections#index")
|
||||
end
|
||||
|
||||
it "routes to #new" do
|
||||
expect(:get => "/network/signature_collections/new").to route_to("network/signature_collections#new")
|
||||
end
|
||||
|
||||
it "routes to #show" do
|
||||
expect(:get => "/network/signature_collections/1").to route_to("network/signature_collections#show", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #edit" do
|
||||
expect(:get => "/network/signature_collections/1/edit").to route_to("network/signature_collections#edit", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #create" do
|
||||
expect(:post => "/network/signature_collections").to route_to("network/signature_collections#create")
|
||||
end
|
||||
|
||||
it "routes to #update via PUT" do
|
||||
expect(:put => "/network/signature_collections/1").to route_to("network/signature_collections#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #update via PATCH" do
|
||||
expect(:patch => "/network/signature_collections/1").to route_to("network/signature_collections#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #destroy" do
|
||||
expect(:delete => "/network/signature_collections/1").to route_to("network/signature_collections#destroy", :id => "1")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "network/signature_collections/edit", type: :view do
|
||||
before(:each) do
|
||||
@network_signature_collection = assign(:network_signature_collection, Network::SignatureCollection.create!(
|
||||
:location_name => "MyString",
|
||||
:location_zip => 1,
|
||||
:location_address => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit network_signature_collection form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", network_signature_collection_path(@network_signature_collection), "post" do
|
||||
|
||||
assert_select "input#network_signature_collection_location_name[name=?]", "network_signature_collection[location_name]"
|
||||
|
||||
assert_select "input#network_signature_collection_location_zip[name=?]", "network_signature_collection[location_zip]"
|
||||
|
||||
assert_select "input#network_signature_collection_location_address[name=?]", "network_signature_collection[location_address]"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "network/signature_collections/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:network_signature_collections, [
|
||||
Network::SignatureCollection.create!(
|
||||
:location_name => "Location Name",
|
||||
:location_zip => 2,
|
||||
:location_address => "Location Address"
|
||||
),
|
||||
Network::SignatureCollection.create!(
|
||||
:location_name => "Location Name",
|
||||
:location_zip => 2,
|
||||
:location_address => "Location Address"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of network/signature_collections" do
|
||||
render
|
||||
assert_select "tr>td", :text => "Location Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Location Address".to_s, :count => 2
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "network/signature_collections/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:network_signature_collection, Network::SignatureCollection.new(
|
||||
:location_name => "MyString",
|
||||
:location_zip => 1,
|
||||
:location_address => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new network_signature_collection form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", network_signature_collections_path, "post" do
|
||||
|
||||
assert_select "input#network_signature_collection_location_name[name=?]", "network_signature_collection[location_name]"
|
||||
|
||||
assert_select "input#network_signature_collection_location_zip[name=?]", "network_signature_collection[location_zip]"
|
||||
|
||||
assert_select "input#network_signature_collection_location_address[name=?]", "network_signature_collection[location_address]"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "network/signature_collections/show", type: :view do
|
||||
before(:each) do
|
||||
@network_signature_collection = assign(:network_signature_collection, Network::SignatureCollection.create!(
|
||||
:location_name => "Location Name",
|
||||
:location_zip => 2,
|
||||
:location_address => "Location Address"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Location Name/)
|
||||
expect(rendered).to match(/2/)
|
||||
expect(rendered).to match(/Location Address/)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user