mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
move rails app into src/, add Vagrantfile & puppet/ assets and add src/.gitignore file
This commit is contained in:
@@ -1,123 +0,0 @@
|
||||
require 'spec_helper'
|
||||
describe BikesController do
|
||||
|
||||
describe "GET index" do
|
||||
it "assigns all bikes as @bikes" do
|
||||
bike = Bike.create! valid_attributes
|
||||
get :index, {}, valid_session
|
||||
assigns(:bikes).should eq([bike])
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET show" do
|
||||
it "assigns the requested bike as @bike" do
|
||||
bike = Bike.create! valid_attributes
|
||||
get :show, {:id => bike.to_param}, valid_session
|
||||
assigns(:bike).should eq(bike)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET new" do
|
||||
it "assigns a new bike as @bike" do
|
||||
get :new, {}, valid_session
|
||||
assigns(:bike).should be_a_new(Bike)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET edit" do
|
||||
it "assigns the requested bike as @bike" do
|
||||
bike = Bike.create! valid_attributes
|
||||
get :edit, {:id => bike.to_param}, valid_session
|
||||
assigns(:bike).should eq(bike)
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST create" do
|
||||
describe "with valid params" do
|
||||
it "creates a new Bike" do
|
||||
expect {
|
||||
post :create, {:bike => valid_attributes}, valid_session
|
||||
}.to change(Bike, :count).by(1)
|
||||
end
|
||||
|
||||
it "assigns a newly created bike as @bike" do
|
||||
post :create, {:bike => valid_attributes}, valid_session
|
||||
assigns(:bike).should be_a(Bike)
|
||||
assigns(:bike).should be_persisted
|
||||
end
|
||||
|
||||
it "redirects to the created bike" do
|
||||
post :create, {:bike => valid_attributes}, valid_session
|
||||
response.should redirect_to(Bike.last)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with invalid params" do
|
||||
it "assigns a newly created but unsaved bike as @bike" do
|
||||
Bike.any_instance.stub(:save).and_return(false)
|
||||
post :create, {:bike => { }}, valid_session
|
||||
assigns(:bike).should be_a_new(Bike)
|
||||
end
|
||||
|
||||
it "re-renders the 'new' template" do
|
||||
Bike.any_instance.stub(:save).and_return(false)
|
||||
post :create, {:bike => { }}, valid_session
|
||||
response.should render_template("new")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "PUT update" do
|
||||
describe "with valid params" do
|
||||
it "updates the requested bike" do
|
||||
bike = Bike.create! valid_attributes
|
||||
Bike.any_instance.should_receive(:update).with({ "these" => "params" })
|
||||
put :update, {:id => bike.to_param, :bike => { "these" => "params" }}, valid_session
|
||||
end
|
||||
|
||||
it "assigns the requested bike as @bike" do
|
||||
bike = Bike.create! valid_attributes
|
||||
put :update, {:id => bike.to_param, :bike => valid_attributes}, valid_session
|
||||
assigns(:bike).should eq(bike)
|
||||
end
|
||||
|
||||
it "redirects to the bike" do
|
||||
bike = Bike.create! valid_attributes
|
||||
put :update, {:id => bike.to_param, :bike => valid_attributes}, valid_session
|
||||
response.should redirect_to(bike)
|
||||
end
|
||||
end
|
||||
|
||||
describe "with invalid params" do
|
||||
it "assigns the bike as @bike" do
|
||||
bike = Bike.create! valid_attributes
|
||||
Bike.any_instance.stub(:save).and_return(false)
|
||||
put :update, {:id => bike.to_param, :bike => { }}, valid_session
|
||||
assigns(:bike).should eq(bike)
|
||||
end
|
||||
|
||||
it "re-renders the 'edit' template" do
|
||||
bike = Bike.create! valid_attributes
|
||||
Bike.any_instance.stub(:save).and_return(false)
|
||||
put :update, {:id => bike.to_param, :bike => { }}, valid_session
|
||||
response.should render_template("edit")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE destroy" do
|
||||
it "destroys the requested bike" do
|
||||
bike = Bike.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, {:id => bike.to_param}, valid_session
|
||||
}.to change(Bike, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the bikes list" do
|
||||
bike = Bike.create! valid_attributes
|
||||
delete :destroy, {:id => bike.to_param}, valid_session
|
||||
response.should redirect_to(bikes_url)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :bike do
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :user do
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the BikesHelper. For example:
|
||||
#
|
||||
# describe BikesHelper 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 BikesHelper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Bike do
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe User do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Bikes" do
|
||||
describe "GET /bikes" 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 bikes_path
|
||||
response.status.should be(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,35 +0,0 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe BikesController do
|
||||
describe "routing" do
|
||||
|
||||
it "routes to #index" do
|
||||
get("/bikes").should route_to("bikes#index")
|
||||
end
|
||||
|
||||
it "routes to #new" do
|
||||
get("/bikes/new").should route_to("bikes#new")
|
||||
end
|
||||
|
||||
it "routes to #show" do
|
||||
get("/bikes/1").should route_to("bikes#show", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #edit" do
|
||||
get("/bikes/1/edit").should route_to("bikes#edit", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #create" do
|
||||
post("/bikes").should route_to("bikes#create")
|
||||
end
|
||||
|
||||
it "routes to #update" do
|
||||
put("/bikes/1").should route_to("bikes#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #destroy" do
|
||||
delete("/bikes/1").should route_to("bikes#destroy", :id => "1")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,42 +0,0 @@
|
||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
ENV["RAILS_ENV"] ||= 'test'
|
||||
require File.expand_path("../../config/environment", __FILE__)
|
||||
require 'rspec/rails'
|
||||
require 'rspec/autorun'
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||
# in spec/support/ and its subdirectories.
|
||||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||
|
||||
# Checks for pending migrations before tests are run.
|
||||
# If you are not using ActiveRecord, you can remove this line.
|
||||
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
||||
|
||||
RSpec.configure do |config|
|
||||
# ## Mock Framework
|
||||
#
|
||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||
#
|
||||
# config.mock_with :mocha
|
||||
# config.mock_with :flexmock
|
||||
# config.mock_with :rr
|
||||
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
|
||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, remove the following line or assign false
|
||||
# instead of true.
|
||||
config.use_transactional_fixtures = true
|
||||
|
||||
# If true, the base class of anonymous controllers will be inferred
|
||||
# automatically. This will be the default behavior in future versions of
|
||||
# rspec-rails.
|
||||
config.infer_base_class_for_anonymous_controllers = false
|
||||
|
||||
# Run specs in random order to surface order dependencies. If you find an
|
||||
# order dependency and want to debug it, you can fix the order by providing
|
||||
# the seed, which is printed after each run.
|
||||
# --seed 1234
|
||||
config.order = "random"
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "bikes/edit" do
|
||||
before(:each) do
|
||||
@bike = assign(:bike, stub_model(Bike))
|
||||
end
|
||||
|
||||
it "renders the edit bike form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form[action=?][method=?]", bike_path(@bike), "post" do
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "bikes/index" do
|
||||
before(:each) do
|
||||
assign(:bikes, [
|
||||
stub_model(Bike),
|
||||
stub_model(Bike)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of bikes" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "bikes/new" do
|
||||
before(:each) do
|
||||
assign(:bike, stub_model(Bike).as_new_record)
|
||||
end
|
||||
|
||||
it "renders new bike form" do
|
||||
render
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form[action=?][method=?]", bikes_path, "post" do
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "bikes/show" do
|
||||
before(:each) do
|
||||
@bike = assign(:bike, stub_model(Bike))
|
||||
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