Browse Source

LK removes autogenerated tests and fixes test and updates gems

master
Loos 10 years ago
parent
commit
3f949080f4
  1. 7
      Gemfile
  2. 134
      Gemfile.lock
  3. 38
      app/controllers/bikes_controller.rb
  4. 6
      notes.txt
  5. 4
      spec/controllers/bikes_controller_spec.rb
  6. 1
      spec/requests/bikes_spec.rb
  7. 39
      spec/routing/bikes_routing_spec.rb
  8. 2
      spec/spec_helper.rb
  9. 15
      spec/views/bikes/edit.html.erb_spec.rb
  10. 15
      spec/views/bikes/index.html.erb_spec.rb
  11. 15
      spec/views/bikes/new.html.erb_spec.rb
  12. 12
      spec/views/bikes/show.html.erb_spec.rb

7
Gemfile

@ -13,12 +13,13 @@ gem 'haml'
gem 'faker' gem 'faker'
group :test, :development do group :test, :development do
gem 'rspec' gem 'rspec', '~> 3.2.0'
gem 'rspec-rails' gem 'rspec-rails', '~> 3.0'
gem 'rspec-mocks', '~> 3.2.0'
gem 'factory_girl' gem 'factory_girl'
gem 'factory_girl_rails', '~> 4.0' gem 'factory_girl_rails', '~> 4.0'
gem 'selenium-webdriver', '2.35.1' gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0' gem 'capybara', '2.2.0'
gem 'pry' gem 'pry'
gem 'pry-rails' gem 'pry-rails'
gem 'better_errors' gem 'better_errors'

134
Gemfile.lock

@ -18,95 +18,97 @@ GEM
activerecord-deprecated_finders (~> 1.0.2) activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.1) activesupport (= 4.0.1)
arel (~> 4.0.0) arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3) activerecord-deprecated_finders (1.0.4)
activesupport (4.0.1) activesupport (4.0.1)
i18n (~> 0.6, >= 0.6.4) i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2) minitest (~> 4.2)
multi_json (~> 1.3) multi_json (~> 1.3)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo (~> 0.3.37) tzinfo (~> 0.3.37)
arel (4.0.1) arel (4.0.2)
assert_difference (0.5.0) assert_difference (1.0.0)
atomic (1.1.14) activesupport (>= 3.0.0)
bcrypt (3.1.7) bcrypt (3.1.10)
bcrypt-ruby (3.1.2) bcrypt-ruby (3.1.2)
better_errors (1.1.0) better_errors (2.1.1)
coderay (>= 1.0.0) coderay (>= 1.0.0)
erubis (>= 2.6.6) erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootstrap-sass (2.3.2.0) bootstrap-sass (2.3.2.0)
sass (~> 3.2) sass (~> 3.2)
builder (3.1.4) builder (3.1.4)
capybara (2.1.0) capybara (2.2.0)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
xpath (~> 2.0) xpath (~> 2.0)
childprocess (0.4.0) childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
coderay (1.1.0) coderay (1.1.0)
coffee-rails (4.0.1) coffee-rails (4.1.0)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.6.3) coffee-script-source (1.9.1.1)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.2.4) devise (3.4.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
responders
thread_safe (~> 0.1) thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.2.5) diff-lcs (1.2.5)
erubis (2.7.0) erubis (2.7.0)
execjs (2.0.2) execjs (2.5.2)
factory_girl (4.3.0) factory_girl (4.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
factory_girl_rails (4.3.0) factory_girl_rails (4.5.0)
factory_girl (~> 4.3.0) factory_girl (~> 4.5.0)
railties (>= 3.0.0) railties (>= 3.0.0)
faker (1.4.3) faker (1.4.3)
i18n (~> 0.5) i18n (~> 0.5)
ffi (1.9.3) ffi (1.9.8)
growl (1.0.3) growl (1.0.3)
haml (4.0.5) haml (4.0.6)
tilt tilt
hike (1.2.3) hike (1.2.3)
i18n (0.6.9) i18n (0.7.0)
jbuilder (1.0.2) jbuilder (1.0.2)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
jquery-rails (3.0.4) jquery-rails (3.0.4)
railties (>= 3.0, < 5.0) railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-turbolinks (2.0.1) jquery-turbolinks (2.1.0)
railties (>= 3.1.0) railties (>= 3.1.0)
turbolinks turbolinks
json (1.8.1) json (1.8.2)
mail (2.5.4) mail (2.5.4)
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
method_source (0.8.2) method_source (0.8.2)
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.5.2) mini_portile (0.6.2)
minitest (4.7.5) minitest (4.7.5)
multi_json (1.8.4) multi_json (1.11.0)
nokogiri (1.6.1) nokogiri (1.6.6.2)
mini_portile (~> 0.5.0) mini_portile (~> 0.6.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
pg (0.15.1) pg (0.15.1)
polyglot (0.3.3) polyglot (0.3.5)
pry (0.9.12.4) pry (0.10.1)
coderay (~> 1.0) coderay (~> 1.1.0)
method_source (~> 0.8) method_source (~> 0.8.1)
slop (~> 3.4) slop (~> 3.4)
pry-rails (0.3.2) pry-rails (0.3.4)
pry (>= 0.9.10) pry (>= 0.9.10)
rack (1.5.2) rack (1.5.2)
rack-test (0.6.2) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.0.1) rails (4.0.1)
actionmailer (= 4.0.1) actionmailer (= 4.0.1)
@ -119,38 +121,46 @@ GEM
rails_12factor (0.0.2) rails_12factor (0.0.2)
rails_serve_static_assets rails_serve_static_assets
rails_stdout_logging rails_stdout_logging
rails_serve_static_assets (0.0.2) rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.3) rails_stdout_logging (0.0.3)
railties (4.0.1) railties (4.0.1)
actionpack (= 4.0.1) actionpack (= 4.0.1)
activesupport (= 4.0.1) activesupport (= 4.0.1)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (10.1.1) rake (10.4.2)
rdoc (3.12.2) rdoc (3.12.2)
json (~> 1.4) json (~> 1.4)
rspec (2.14.1) responders (1.1.2)
rspec-core (~> 2.14.0) railties (>= 3.2, < 4.2)
rspec-expectations (~> 2.14.0) rspec (3.2.0)
rspec-mocks (~> 2.14.0) rspec-core (~> 3.2.0)
rspec-core (2.14.7) rspec-expectations (~> 3.2.0)
rspec-expectations (2.14.4) rspec-mocks (~> 3.2.0)
diff-lcs (>= 1.1.3, < 2.0) rspec-core (3.2.3)
rspec-mocks (2.14.4) rspec-support (~> 3.2.0)
rspec-rails (2.14.1) rspec-expectations (3.2.1)
actionpack (>= 3.0) diff-lcs (>= 1.2.0, < 2.0)
activemodel (>= 3.0) rspec-support (~> 3.2.0)
activesupport (>= 3.0) rspec-mocks (3.2.1)
railties (>= 3.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-core (~> 2.14.0) rspec-support (~> 3.2.0)
rspec-expectations (~> 2.14.0) rspec-rails (3.2.1)
rspec-mocks (~> 2.14.0) actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rubyzip (0.9.9) rubyzip (0.9.9)
sass (3.2.13) sass (3.2.19)
sass-rails (4.0.1) sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10) sass (~> 3.2.2)
sprockets-rails (~> 2.0.0) sprockets (~> 2.8, < 3.0)
sprockets-rails (~> 2.0)
sdoc (0.3.20) sdoc (0.3.20)
json (>= 1.1.3) json (>= 1.1.3)
rdoc (~> 3.10) rdoc (~> 3.10)
@ -159,8 +169,8 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
rubyzip (< 1.0.0) rubyzip (< 1.0.0)
websocket (~> 1.0.4) websocket (~> 1.0.4)
slop (3.4.7) slop (3.6.0)
sprockets (2.10.1) sprockets (2.12.3)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0) multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
@ -169,16 +179,15 @@ GEM
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (~> 2.8) sprockets (~> 2.8)
thor (0.18.1) thor (0.19.1)
thread_safe (0.1.3) thread_safe (0.3.5)
atomic
tilt (1.4.1) tilt (1.4.1)
treetop (1.4.15) treetop (1.4.15)
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
turbolinks (1.1.1) turbolinks (1.1.1)
coffee-rails coffee-rails
tzinfo (0.3.38) tzinfo (0.3.43)
uglifier (2.1.1) uglifier (2.1.1)
execjs (>= 0.3.0) execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2) multi_json (~> 1.0, >= 1.0.2)
@ -197,7 +206,7 @@ DEPENDENCIES
better_errors better_errors
binding_of_caller binding_of_caller
bootstrap-sass (= 2.3.2.0) bootstrap-sass (= 2.3.2.0)
capybara (= 2.1.0) capybara (= 2.2.0)
devise devise
factory_girl factory_girl
factory_girl_rails (~> 4.0) factory_girl_rails (~> 4.0)
@ -212,8 +221,9 @@ DEPENDENCIES
pry-rails pry-rails
rails (= 4.0.1) rails (= 4.0.1)
rails_12factor (= 0.0.2) rails_12factor (= 0.0.2)
rspec rspec (~> 3.2.0)
rspec-rails rspec-mocks (~> 3.2.0)
rspec-rails (~> 3.0)
sass-rails (~> 4.0.0) sass-rails (~> 4.0.0)
sdoc (= 0.3.20) sdoc (= 0.3.20)
selenium-webdriver (= 2.35.1) selenium-webdriver (= 2.35.1)

38
app/controllers/bikes_controller.rb

@ -4,9 +4,9 @@ class BikesController < ApplicationController
def index def index
@bikes = Bike.all @bikes = Bike.all
@unsold_bikes = @bikes.select{|bike| @unsold_bikes = @bikes.select{ |bike|
!bike.date_sold && !bike.date_sold &&
(bike.purpose == "Sale") (bike.purpose == "Sale")
} }
end end
@ -75,26 +75,26 @@ class BikesController < ApplicationController
def bike_params def bike_params
params.require(:bike).permit( params.require(:bike).permit(
:entry_date, :entry_date,
:brand, :brand,
:model, :model,
:bike_type, :bike_type,
:color, :color,
:log_number, :log_number,
:purpose, :purpose,
:serial_number, :serial_number,
:notes, :notes,
:tag_info, :tag_info,
:mechanic, :mechanic,
:completion_date, :completion_date,
:price, :price,
:top_tube_size, :top_tube_size,
:seat_tube_size, :seat_tube_size,
:new_parts, :new_parts,
:work_done, :work_done,
:date_sold, :date_sold,
:created_at, :created_at,
:updated_at) :updated_at)
end end
def print_params def print_params

6
notes.txt

@ -27,4 +27,8 @@ add a request-a-feature feature
add pics of bikes for sale add pics of bikes for sale
add recyclery logos & bike memorabilia pics all over app add recyclery logos & bike memorabilia pics all over app
do bike sales labels fit into sleeves? (sheaths are 5x3.75)
freecyclery bikes need receipts
when application is voided, bike should go back to pool of bikes
when client is created without date, app breaks
phone calls made is unnecessary - notes are usualy used

4
spec/controllers/bikes_controller_spec.rb

@ -1,12 +1,12 @@
require 'spec_helper' require 'spec_helper'
describe BikesController do describe BikesController do
let(:user){FactoryGirl.create(:user)} let(:user){FactoryGirl.create(:user)}
let(:bike){FactoryGirl.create(:bike)} let(:bike){FactoryGirl.create(:bike)}
before :each do before :each do
controller.stub(:current_user).and_return(user) sign_in user
controller.stub(:authenticate_user!).and_return true
end end
describe "POST #create" do describe "POST #create" do

1
spec/requests/bikes_spec.rb

@ -1 +0,0 @@
require 'spec_helper'

39
spec/routing/bikes_routing_spec.rb

@ -1,39 +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
it "routes to #print_select" do
get("/bikes/print_select").should route_to("bikes#print_select")
end
end
end

2
spec/spec_helper.rb

@ -8,8 +8,10 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration) ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config| RSpec.configure do |config|
config.infer_spec_type_from_file_location!
config.fixture_path = "#{::Rails.root}/spec/fixtures" config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false config.infer_base_class_for_anonymous_controllers = false
config.include Devise::TestHelpers, type: :controller
config.order = "random" config.order = "random"
end end

15
spec/views/bikes/edit.html.erb_spec.rb

@ -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

15
spec/views/bikes/index.html.erb_spec.rb

@ -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

15
spec/views/bikes/new.html.erb_spec.rb

@ -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

12
spec/views/bikes/show.html.erb_spec.rb

@ -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
Loading…
Cancel
Save