diff --git a/Gemfile b/Gemfile index 2fe6b6b..b6cc030 100644 --- a/Gemfile +++ b/Gemfile @@ -13,12 +13,13 @@ gem 'haml' gem 'faker' group :test, :development do - gem 'rspec' - gem 'rspec-rails' + gem 'rspec', '~> 3.2.0' + gem 'rspec-rails', '~> 3.0' + gem 'rspec-mocks', '~> 3.2.0' gem 'factory_girl' gem 'factory_girl_rails', '~> 4.0' gem 'selenium-webdriver', '2.35.1' - gem 'capybara', '2.1.0' + gem 'capybara', '2.2.0' gem 'pry' gem 'pry-rails' gem 'better_errors' diff --git a/Gemfile.lock b/Gemfile.lock index d76ab00..c0fcba9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,95 +18,97 @@ GEM activerecord-deprecated_finders (~> 1.0.2) activesupport (= 4.0.1) arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) + activerecord-deprecated_finders (1.0.4) activesupport (4.0.1) i18n (~> 0.6, >= 0.6.4) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) - arel (4.0.1) - assert_difference (0.5.0) - atomic (1.1.14) - bcrypt (3.1.7) + arel (4.0.2) + assert_difference (1.0.0) + activesupport (>= 3.0.0) + bcrypt (3.1.10) bcrypt-ruby (3.1.2) - better_errors (1.1.0) + better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) + rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) bootstrap-sass (2.3.2.0) sass (~> 3.2) builder (3.1.4) - capybara (2.1.0) + capybara (2.2.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - childprocess (0.4.0) + childprocess (0.5.6) ffi (~> 1.0, >= 1.0.11) coderay (1.1.0) - coffee-rails (4.0.1) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) - coffee-script (2.2.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.6.3) + coffee-script-source (1.9.1.1) debug_inspector (0.0.2) - devise (3.2.4) + devise (3.4.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) + responders thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.2.5) erubis (2.7.0) - execjs (2.0.2) - factory_girl (4.3.0) + execjs (2.5.2) + factory_girl (4.5.0) activesupport (>= 3.0.0) - factory_girl_rails (4.3.0) - factory_girl (~> 4.3.0) + factory_girl_rails (4.5.0) + factory_girl (~> 4.5.0) railties (>= 3.0.0) faker (1.4.3) i18n (~> 0.5) - ffi (1.9.3) + ffi (1.9.8) growl (1.0.3) - haml (4.0.5) + haml (4.0.6) tilt hike (1.2.3) - i18n (0.6.9) + i18n (0.7.0) jbuilder (1.0.2) activesupport (>= 3.0.0) jquery-rails (3.0.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - jquery-turbolinks (2.0.1) + jquery-turbolinks (2.1.0) railties (>= 3.1.0) turbolinks - json (1.8.1) + json (1.8.2) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) method_source (0.8.2) mime-types (1.25.1) - mini_portile (0.5.2) + mini_portile (0.6.2) minitest (4.7.5) - multi_json (1.8.4) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + multi_json (1.11.0) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) orm_adapter (0.5.0) pg (0.15.1) - polyglot (0.3.3) - pry (0.9.12.4) - coderay (~> 1.0) - method_source (~> 0.8) + polyglot (0.3.5) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) slop (~> 3.4) - pry-rails (0.3.2) + pry-rails (0.3.4) pry (>= 0.9.10) rack (1.5.2) - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) rails (4.0.1) actionmailer (= 4.0.1) @@ -119,38 +121,46 @@ GEM rails_12factor (0.0.2) rails_serve_static_assets rails_stdout_logging - rails_serve_static_assets (0.0.2) + rails_serve_static_assets (0.0.4) rails_stdout_logging (0.0.3) railties (4.0.1) actionpack (= 4.0.1) activesupport (= 4.0.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.1.1) + rake (10.4.2) rdoc (3.12.2) json (~> 1.4) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.7) - rspec-expectations (2.14.4) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.4) - rspec-rails (2.14.1) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) + responders (1.1.2) + railties (>= 3.2, < 4.2) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.3) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-rails (3.2.1) + 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) - sass (3.2.13) - sass-rails (4.0.1) + sass (3.2.19) + sass-rails (4.0.5) railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 3.0) + sprockets-rails (~> 2.0) sdoc (0.3.20) json (>= 1.1.3) rdoc (~> 3.10) @@ -159,8 +169,8 @@ GEM multi_json (~> 1.0) rubyzip (< 1.0.0) websocket (~> 1.0.4) - slop (3.4.7) - sprockets (2.10.1) + slop (3.6.0) + sprockets (2.12.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) @@ -169,16 +179,15 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) - thor (0.18.1) - thread_safe (0.1.3) - atomic + thor (0.19.1) + thread_safe (0.3.5) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) turbolinks (1.1.1) coffee-rails - tzinfo (0.3.38) + tzinfo (0.3.43) uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) @@ -197,7 +206,7 @@ DEPENDENCIES better_errors binding_of_caller bootstrap-sass (= 2.3.2.0) - capybara (= 2.1.0) + capybara (= 2.2.0) devise factory_girl factory_girl_rails (~> 4.0) @@ -212,8 +221,9 @@ DEPENDENCIES pry-rails rails (= 4.0.1) rails_12factor (= 0.0.2) - rspec - rspec-rails + rspec (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-rails (~> 3.0) sass-rails (~> 4.0.0) sdoc (= 0.3.20) selenium-webdriver (= 2.35.1) diff --git a/app/controllers/bikes_controller.rb b/app/controllers/bikes_controller.rb index 82e85bb..dbd8bd9 100644 --- a/app/controllers/bikes_controller.rb +++ b/app/controllers/bikes_controller.rb @@ -4,9 +4,9 @@ class BikesController < ApplicationController def index @bikes = Bike.all - @unsold_bikes = @bikes.select{|bike| - !bike.date_sold && - (bike.purpose == "Sale") + @unsold_bikes = @bikes.select{ |bike| + !bike.date_sold && + (bike.purpose == "Sale") } end @@ -75,26 +75,26 @@ class BikesController < ApplicationController def bike_params params.require(:bike).permit( - :entry_date, - :brand, - :model, - :bike_type, - :color, - :log_number, - :purpose, - :serial_number, - :notes, - :tag_info, - :mechanic, - :completion_date, - :price, - :top_tube_size, + :entry_date, + :brand, + :model, + :bike_type, + :color, + :log_number, + :purpose, + :serial_number, + :notes, + :tag_info, + :mechanic, + :completion_date, + :price, + :top_tube_size, :seat_tube_size, :new_parts, :work_done, :date_sold, - :created_at, - :updated_at) + :created_at, + :updated_at) end def print_params diff --git a/notes.txt b/notes.txt index 5cbc6f5..0591a60 100644 --- a/notes.txt +++ b/notes.txt @@ -27,4 +27,8 @@ add a request-a-feature feature add pics of bikes for sale 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 diff --git a/spec/controllers/bikes_controller_spec.rb b/spec/controllers/bikes_controller_spec.rb index 918dc35..538fad5 100644 --- a/spec/controllers/bikes_controller_spec.rb +++ b/spec/controllers/bikes_controller_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' + describe BikesController do let(:user){FactoryGirl.create(:user)} let(:bike){FactoryGirl.create(:bike)} before :each do - controller.stub(:current_user).and_return(user) - controller.stub(:authenticate_user!).and_return true + sign_in user end describe "POST #create" do diff --git a/spec/requests/bikes_spec.rb b/spec/requests/bikes_spec.rb deleted file mode 100644 index f8ec369..0000000 --- a/spec/requests/bikes_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require 'spec_helper' diff --git a/spec/routing/bikes_routing_spec.rb b/spec/routing/bikes_routing_spec.rb deleted file mode 100644 index 23d942a..0000000 --- a/spec/routing/bikes_routing_spec.rb +++ /dev/null @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index aa5d83b..190b16a 100644 --- a/spec/spec_helper.rb +++ b/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) RSpec.configure do |config| + config.infer_spec_type_from_file_location! config.fixture_path = "#{::Rails.root}/spec/fixtures" config.use_transactional_fixtures = true config.infer_base_class_for_anonymous_controllers = false + config.include Devise::TestHelpers, type: :controller config.order = "random" end diff --git a/spec/views/bikes/edit.html.erb_spec.rb b/spec/views/bikes/edit.html.erb_spec.rb deleted file mode 100644 index 12b30d9..0000000 --- a/spec/views/bikes/edit.html.erb_spec.rb +++ /dev/null @@ -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 diff --git a/spec/views/bikes/index.html.erb_spec.rb b/spec/views/bikes/index.html.erb_spec.rb deleted file mode 100644 index 0333284..0000000 --- a/spec/views/bikes/index.html.erb_spec.rb +++ /dev/null @@ -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 diff --git a/spec/views/bikes/new.html.erb_spec.rb b/spec/views/bikes/new.html.erb_spec.rb deleted file mode 100644 index 0eb5a77..0000000 --- a/spec/views/bikes/new.html.erb_spec.rb +++ /dev/null @@ -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 diff --git a/spec/views/bikes/show.html.erb_spec.rb b/spec/views/bikes/show.html.erb_spec.rb deleted file mode 100644 index 94a1bfe..0000000 --- a/spec/views/bikes/show.html.erb_spec.rb +++ /dev/null @@ -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
" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - end -end