diff --git a/db/migrate/20150122232003_remove_upvotes.rb b/db/migrate/20150122232003_remove_upvotes.rb deleted file mode 100644 index 6722018..0000000 --- a/db/migrate/20150122232003_remove_upvotes.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveUpvotes < ActiveRecord::Migration - def change - drop_table :upvotes - end -end diff --git a/db/migrate/20150127020039_drop_scrapes.rb b/db/migrate/20150127020039_drop_scrapes.rb deleted file mode 100644 index 04cb2ea..0000000 --- a/db/migrate/20150127020039_drop_scrapes.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropScrapes < ActiveRecord::Migration - def change - drop_table :scrapes - end -end diff --git a/db/schema.rb b/db/schema.rb index 2060356..8854684 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150127020039) do +ActiveRecord::Schema.define(version: 20150127015409) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index b28628e..600a6c0 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,11 +1,12 @@ RSpec.describe UsersController, :type => :controller do - + + #INDEX describe "GET #index" do it "responds successfully with an HTTP 200 status code" do - get :index - expect(response).to be_success - expect(response).to have_http_status(200) - end + get :index + expect(response).to be_success + expect(response).to have_http_status(200) + end it "renders the index template" do get :index @@ -13,19 +14,31 @@ end end - # describe "GET #show" do - # it "assigns the requested user to @user" do - # user = FactoryGirl.build(:a_user) - # get :show, id: user - # assigns(:user).should eq(user) - # end + #SHOW + describe "GET #show" do + it "assigns the requested user to @user" do + user = FactoryGirl.create(:user) + get :show, id: user + expect(assigns(:user)).to eq(user) + end - # it "renders the #show view" do - # user = FactoryGirl.build(:a_user) - # get :show, id: user - # response.should render_template :show - # end + it "renders the #show view" do + user = FactoryGirl.create(:user) + get :show, id: user + expect(response).to render_template :show + end + end + + #NEW + describe "GET #new" do + it "renders the new template" do + get :new + expect(response).to render_template("new") + end + end - # end + #CREATE + #EDIT + #UPDATE end diff --git a/spec/factories/user_factory.rb b/spec/factories/user_factory.rb index 6639450..6f7de5a 100644 --- a/spec/factories/user_factory.rb +++ b/spec/factories/user_factory.rb @@ -1,13 +1,14 @@ -FactoryGirl.define do - +FactoryGirl.define do + sequence :email do |n| + "test#{n}@example.com" + end #Creating an example user in this factory allows us to reference it in the rspec file - factory :a_user, class: User do - + factory :user do name "Dummy" - email "dummy@example.com" - password "dummy" - + email + password "dummy1234" + # password has to be minimum 8 characters due to validation end end \ No newline at end of file diff --git a/spec/support/factory_girl.rb b/spec/support/factory_girl.rb new file mode 100644 index 0000000..bc21fc6 --- /dev/null +++ b/spec/support/factory_girl.rb @@ -0,0 +1,12 @@ +RSpec.configure do |config| + config.include FactoryGirl::Syntax::Methods + + config.before(:suite) do + begin + #DatabaseCleaner.start + FactoryGirl.lint + ensure + #DatabaseCleaner.clean + end + end +end \ No newline at end of file