From 38f895e484503d69d356e537a171de2303093064 Mon Sep 17 00:00:00 2001 From: Brad Date: Sat, 25 Feb 2017 18:55:34 -0700 Subject: [PATCH 01/14] Add Factory Girl --- Gemfile | 1 + Gemfile.lock | 8 +++++++- spec/support/factories.rb | 3 +++ spec/support/factory_girl.rb | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 spec/support/factories.rb create mode 100644 spec/support/factory_girl.rb diff --git a/Gemfile b/Gemfile index 390999a..8ada858 100644 --- a/Gemfile +++ b/Gemfile @@ -39,4 +39,5 @@ group :development, :test do gem 'capybara' gem 'launchy' gem 'rspec-rails' + gem 'factory_girl_rails' end diff --git a/Gemfile.lock b/Gemfile.lock index cd1145d..2f2e612 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,6 +48,11 @@ GEM diff-lcs (1.2.5) erubis (2.7.0) execjs (2.7.0) + factory_girl (4.8.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.8.0) + factory_girl (~> 4.8.0) + railties (>= 3.0.0) faraday (0.9.2) multipart-post (>= 1.2, < 3) font-awesome-rails (4.6.3.1) @@ -171,6 +176,7 @@ DEPENDENCIES byebug capybara coffee-rails (~> 4.0.0) + factory_girl_rails font-awesome-rails foundation-rails jquery-rails @@ -189,4 +195,4 @@ RUBY VERSION ruby 2.2.2p95 BUNDLED WITH - 1.14.3 + 1.14.5 diff --git a/spec/support/factories.rb b/spec/support/factories.rb new file mode 100644 index 0000000..ae3e4b1 --- /dev/null +++ b/spec/support/factories.rb @@ -0,0 +1,3 @@ +FactoryGirl.define do + # +end diff --git a/spec/support/factory_girl.rb b/spec/support/factory_girl.rb new file mode 100644 index 0000000..eec437f --- /dev/null +++ b/spec/support/factory_girl.rb @@ -0,0 +1,3 @@ +RSpec.configure do |config| + config.include FactoryGirl::Syntax::Methods +end From 7343b588bbc53614a9ffa69a96e0cd49fda93dee Mon Sep 17 00:00:00 2001 From: Brad Date: Sat, 25 Feb 2017 19:08:07 -0700 Subject: [PATCH 02/14] Fix login new user helper method --- spec/support/feature_helpers.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index 72a18d1..b4e92ee 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -1,7 +1,9 @@ module FeatureHelpers def login_new_user(options = {}) visit "/" - click_link "Sign in" + within(:css, ".super-button") do + click_link "Sign in or sign up" + end user = User.last user.admin = options[:admin] || false user.approval_at = options[:approval_at] || Time.now From 37d6b10ff6e8daa0a15d41fe818970e67c881977 Mon Sep 17 00:00:00 2001 From: Brad Date: Sat, 25 Feb 2017 20:07:42 -0700 Subject: [PATCH 03/14] Fix a bunch of failing tests --- spec/features/users_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index d783e19..9914742 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -42,9 +42,7 @@ context "and the current user clicks the approve link for that user" do before do - within(:row_for, subject) do - click_link "Approve" - end + find(:xpath, "//a[@href='/users/#{subject.id}/approve']").click end it "approves the user" do From c3e0095955ec11f0ceb8ff9deac8238006a3fba7 Mon Sep 17 00:00:00 2001 From: Brad Date: Sun, 26 Feb 2017 19:17:24 -0700 Subject: [PATCH 04/14] Fix remaining failing tests with Factory Girl implementation --- spec/factories/users.rb | 12 +++++ spec/features/.DS_Store | Bin 0 -> 6148 bytes spec/features/users_spec.rb | 98 +++++++++++++++--------------------- 3 files changed, 53 insertions(+), 57 deletions(-) create mode 100644 spec/factories/users.rb create mode 100644 spec/features/.DS_Store diff --git a/spec/factories/users.rb b/spec/factories/users.rb new file mode 100644 index 0000000..d0a52c1 --- /dev/null +++ b/spec/factories/users.rb @@ -0,0 +1,12 @@ +FactoryGirl.define do + factory :user do + provider "google_oauth2" + sequence :uid do |n| + n + end + sequence :name do |n| + "Fake User#{n}" + end + approval_at "2017-02-25 23:28:13" + end +end diff --git a/spec/features/.DS_Store b/spec/features/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 "Example User", - "Created At" => subject.created_at_string, - "Approval At" => subject.approval_at_string, - "Admin" => "true", - "Actions" => "Remove Approval Delete", - } - ) + it "sees a table with proper headers and rows" do + expect(page).to have_css("#user_#{admin.id}", :text => "#{admin.name}") + expect(page).to have_css("#user_#{admin.id}", :text => "#{admin.created_at_string}") + expect(page).to have_css("#user_#{admin.id}", :text => "#{admin.approval_at_string}") + expect(page).to have_css("#user_#{admin.id}", :text => "Delete") + expect(page).to have_css("#user_#{admin.id}", :text => "Yes") + expect(page).to_not have_css("#user_#{admin.id}", :text => "No") end - context "and a new non-admin user is added" do - subject! { User.create!(name: "Joe") } - - before { visit users_index_path } + it "sees a table with proper headers and rows" do + expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.name}") + expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.created_at_string}") + expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.approval_at_string}") + expect(page).to have_link('Yes', :href => remove_approval_user_path(users.first.id)) + expect(page).to_not have_link('No', :href => approve_user_path(users.first.id)) + expect(page).to have_link('No', :href => toggle_admin_user_path(users.first.id)) + expect(page).to_not have_link('Yes', :href => toggle_admin_user_path(users.first.id)) + end - it "fills the table with that user\"s information too" do - check_headers_and_values_on_generic_index_page( - "users_table", { - "Name" => "Joe", - "Created At" => subject.created_at_string, - "Approval At" => "", - "Admin" => "", - "Actions" => "Approve Delete", - } - ) + context "the admin clicks Yes for user approval" do + before do + find(:xpath, "//a[@href='/users/#{unapproved_user.id}/approve']").click end - context "and the current user clicks the approve link for that user" do - before do - find(:xpath, "//a[@href='/users/#{subject.id}/approve']").click - end + it "approves the user" do + expect(unapproved_user.reload).to be_approved + end - it "approves the user" do - expect(subject.reload).to be_approved - end + it "displays an approval time" do + expect(page).to have_content(unapproved_user.approval_at_string) + end - it "displays an approval time" do - within(:row_for, subject) do - expect(find(:value_under_header, "Approval At").text).to_not be_blank - end - end + it "no longer shows the approve link" do + expect(page).to have_link('Yes', :href => remove_approval_user_path(unapproved_user)) + end - it "no longer shows the approve link" do - within(:row_for, subject) do - expect(find(:value_under_header, "Actions").text).to eq "Remove Approval Delete" - end + context "and the admin clicks No for user approval for same user" do + before do + find(:xpath, "//a[@href='/users/#{unapproved_user.id}/remove_approval']").click end - context "and the current user clicks the Remove Approval link for that user" do - before do - within(:row_for, subject) do - click_link "Remove Approval" - end - end - - it "removes the user's approval" do - expect(subject.reload).to_not be_approved - end + it "removes the user's approval" do + expect(unapproved_user.reload).to_not be_approved end end - context "and the current user clicks the delete link for that user" do + context "and the admin clicks the delete link for same user" do before do - within(:row_for, subject) do + within(:css, "#user_#{unapproved_user.id}") do click_link "Delete" end end it "deletes the user" do - expect(User.find_by_id(subject.id)).to be_nil + expect(User.find_by_id(unapproved_user.id)).to be_nil end end end From 4117ffb5917e9b4e0250bf2c1d05fdd20d3469f8 Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 15:47:11 -0700 Subject: [PATCH 05/14] Change incorrect test name --- spec/features/users_spec.rb | 7 ++++--- spec/support/factories.rb | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 spec/support/factories.rb diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 2f0c161..09b35d0 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -31,9 +31,10 @@ expect(page).to_not have_link('Yes', :href => toggle_admin_user_path(users.first.id)) end - context "the admin clicks Yes for user approval" do + context "the admin clicks No for user approval" do before do - find(:xpath, "//a[@href='/users/#{unapproved_user.id}/approve']").click + # find(:xpath, "//a[@href='/users/#{unapproved_user.id}/approve']").click + find(:xpath, approve_user_path(unapproved_user)).click end it "approves the user" do @@ -44,7 +45,7 @@ expect(page).to have_content(unapproved_user.approval_at_string) end - it "no longer shows the approve link" do + it "shows Yes instead of No button" do expect(page).to have_link('Yes', :href => remove_approval_user_path(unapproved_user)) end diff --git a/spec/support/factories.rb b/spec/support/factories.rb deleted file mode 100644 index ae3e4b1..0000000 --- a/spec/support/factories.rb +++ /dev/null @@ -1,3 +0,0 @@ -FactoryGirl.define do - # -end From 0bf74f676f3ef4abfbca7eafd65bc41895bfdf2d Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 16:07:49 -0700 Subject: [PATCH 06/14] Add dynamic class to approve user button --- app/models/user.rb | 4 ++++ app/views/users/index.html.erb | 4 ++-- spec/features/users_spec.rb | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index d547333..c2a09ea 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -15,6 +15,10 @@ def admin_button_class admin? ? "success" : "secondary" end + def user_button_class + approved? ? "approved" : "not-approved" + end + def approved? approval_at.present? end diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 1f88c66..197c8a8 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -19,8 +19,8 @@ <%= user.created_at_string %> - <%= link_to("No", [:approve, user], class: "button tiny secondary") unless user.approved? %> - <%= link_to("Yes", [:remove_approval, user], class: "button tiny success") if user.approved? %> + <%= link_to("No", [:approve, user], class: "button tiny secondary #{user.user_button_class}") unless user.approved? %> + <%= link_to("Yes", [:remove_approval, user], class: "button tiny success #{user.user_button_class}") if user.approved? %> <%= user.approval_at_string %> diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 09b35d0..83cce5e 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -33,8 +33,8 @@ context "the admin clicks No for user approval" do before do - # find(:xpath, "//a[@href='/users/#{unapproved_user.id}/approve']").click - find(:xpath, approve_user_path(unapproved_user)).click + find('.not-approved').click + end it "approves the user" do From 4bd48abfd1eecfcadf1c08017c61383715025e9d Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 16:09:25 -0700 Subject: [PATCH 07/14] Change nested context test description to begin with word and --- spec/features/users_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 83cce5e..3c4e879 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -31,7 +31,7 @@ expect(page).to_not have_link('Yes', :href => toggle_admin_user_path(users.first.id)) end - context "the admin clicks No for user approval" do + context "and admin clicks No for user approval" do before do find('.not-approved').click From 4019c6ed672a70a58fdb48bc5cf76cba919f1804 Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 16:10:15 -0700 Subject: [PATCH 08/14] Make quote use more consistent --- spec/features/users_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 3c4e879..d19b4c2 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -25,10 +25,10 @@ expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.name}") expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.created_at_string}") expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.approval_at_string}") - expect(page).to have_link('Yes', :href => remove_approval_user_path(users.first.id)) - expect(page).to_not have_link('No', :href => approve_user_path(users.first.id)) - expect(page).to have_link('No', :href => toggle_admin_user_path(users.first.id)) - expect(page).to_not have_link('Yes', :href => toggle_admin_user_path(users.first.id)) + expect(page).to have_link("Yes", :href => remove_approval_user_path(users.first.id)) + expect(page).to_not have_link("No", :href => approve_user_path(users.first.id)) + expect(page).to have_link("No", :href => toggle_admin_user_path(users.first.id)) + expect(page).to_not have_link("Yes", :href => toggle_admin_user_path(users.first.id)) end context "and admin clicks No for user approval" do From 4a0efabc542868eec009b6928f1c940cc6b0dbba Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 16:20:51 -0700 Subject: [PATCH 09/14] Remove unnecessary interpolation --- spec/features/users_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index d19b4c2..a4ce820 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -22,9 +22,9 @@ end it "sees a table with proper headers and rows" do - expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.name}") - expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.created_at_string}") - expect(page).to have_css("#user_#{users.first.id}", :text => "#{users.first.approval_at_string}") + expect(page).to have_css("#user_#{users.first.id}", :text => users.first.name) + expect(page).to have_css("#user_#{users.first.id}", :text => users.first.created_at_string) + expect(page).to have_css("#user_#{users.first.id}", :text => users.first.approval_at_string) expect(page).to have_link("Yes", :href => remove_approval_user_path(users.first.id)) expect(page).to_not have_link("No", :href => approve_user_path(users.first.id)) expect(page).to have_link("No", :href => toggle_admin_user_path(users.first.id)) From a2f788160f9cc940f9db1556de8d7c9bdacaa06b Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 21:35:40 -0700 Subject: [PATCH 10/14] Change test to test proper order of data in table --- spec/features/users_spec.rb | 29 ++++++++++++++--------------- spec/support/feature_helpers.rb | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index a4ce820..3c645fb 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -12,23 +12,22 @@ expect(page).to have_table("users_table") end - it "sees a table with proper headers and rows" do - expect(page).to have_css("#user_#{admin.id}", :text => "#{admin.name}") - expect(page).to have_css("#user_#{admin.id}", :text => "#{admin.created_at_string}") - expect(page).to have_css("#user_#{admin.id}", :text => "#{admin.approval_at_string}") - expect(page).to have_css("#user_#{admin.id}", :text => "Delete") - expect(page).to have_css("#user_#{admin.id}", :text => "Yes") - expect(page).to_not have_css("#user_#{admin.id}", :text => "No") + it "sees a table with proper headers and admin row data" do + page.find("#user_#{admin.id} td:nth-of-type(1)", :text => admin.name) + page.find("#user_#{admin.id} td:nth-of-type(2)", :text => admin.created_at_string) + page.find("#user_#{admin.id} td:nth-of-type(3)", :text => "Yes") + page.find("#user_#{admin.id} td:nth-of-type(4)", :text => admin.approval_at_string) + page.find("#user_#{admin.id} td:nth-of-type(5)", :text => "Yes") + page.find("#user_#{admin.id} td:nth-of-type(6)", :text => "Delete") end - it "sees a table with proper headers and rows" do - expect(page).to have_css("#user_#{users.first.id}", :text => users.first.name) - expect(page).to have_css("#user_#{users.first.id}", :text => users.first.created_at_string) - expect(page).to have_css("#user_#{users.first.id}", :text => users.first.approval_at_string) - expect(page).to have_link("Yes", :href => remove_approval_user_path(users.first.id)) - expect(page).to_not have_link("No", :href => approve_user_path(users.first.id)) - expect(page).to have_link("No", :href => toggle_admin_user_path(users.first.id)) - expect(page).to_not have_link("Yes", :href => toggle_admin_user_path(users.first.id)) + it "sees a table with proper headers and user row data" do + page.find("#user_#{users.first.id} td:nth-of-type(1)", :text => users.first.name) + page.find("#user_#{users.first.id} td:nth-of-type(2)", :text => users.first.created_at_string) + page.find("#user_#{users.first.id} td:nth-of-type(3)", :text => "Yes") + page.find("#user_#{users.first.id} td:nth-of-type(4)", :text => users.first.approval_at_string) + page.find("#user_#{users.first.id} td:nth-of-type(5)", :text => "No") + page.find("#user_#{users.first.id} td:nth-of-type(6)", :text => "Delete") end context "and admin clicks No for user approval" do diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index b4e92ee..efeff08 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -24,7 +24,7 @@ def check_headers_and_values_on_generic_index_page(table_locator, headers_and_va end end - within(:row_for, subject) do + within(:row_for, headers_and_values_hash) do headers_and_values_hash.each do |header, value| expect({ header => find(:value_under_header, header).text }).to eq({ header => value }) end From cfcc469fa422247f1c38b9631418589c4cd823ac Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 21:37:19 -0700 Subject: [PATCH 11/14] Remove hash rockets in favor of newer syntax --- spec/features/users_spec.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 3c645fb..bca73be 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -13,21 +13,21 @@ end it "sees a table with proper headers and admin row data" do - page.find("#user_#{admin.id} td:nth-of-type(1)", :text => admin.name) - page.find("#user_#{admin.id} td:nth-of-type(2)", :text => admin.created_at_string) - page.find("#user_#{admin.id} td:nth-of-type(3)", :text => "Yes") - page.find("#user_#{admin.id} td:nth-of-type(4)", :text => admin.approval_at_string) - page.find("#user_#{admin.id} td:nth-of-type(5)", :text => "Yes") - page.find("#user_#{admin.id} td:nth-of-type(6)", :text => "Delete") + page.find("#user_#{admin.id} td:nth-of-type(1)", text: admin.name) + page.find("#user_#{admin.id} td:nth-of-type(2)", text: admin.created_at_string) + page.find("#user_#{admin.id} td:nth-of-type(3)", text: "Yes") + page.find("#user_#{admin.id} td:nth-of-type(4)", text: admin.approval_at_string) + page.find("#user_#{admin.id} td:nth-of-type(5)", text: "Yes") + page.find("#user_#{admin.id} td:nth-of-type(6)", text: "Delete") end it "sees a table with proper headers and user row data" do - page.find("#user_#{users.first.id} td:nth-of-type(1)", :text => users.first.name) - page.find("#user_#{users.first.id} td:nth-of-type(2)", :text => users.first.created_at_string) - page.find("#user_#{users.first.id} td:nth-of-type(3)", :text => "Yes") - page.find("#user_#{users.first.id} td:nth-of-type(4)", :text => users.first.approval_at_string) - page.find("#user_#{users.first.id} td:nth-of-type(5)", :text => "No") - page.find("#user_#{users.first.id} td:nth-of-type(6)", :text => "Delete") + page.find("#user_#{users.first.id} td:nth-of-type(1)", text: users.first.name) + page.find("#user_#{users.first.id} td:nth-of-type(2)", text: users.first.created_at_string) + page.find("#user_#{users.first.id} td:nth-of-type(3)", text: "Yes") + page.find("#user_#{users.first.id} td:nth-of-type(4)", text: users.first.approval_at_string) + page.find("#user_#{users.first.id} td:nth-of-type(5)", text: "No") + page.find("#user_#{users.first.id} td:nth-of-type(6)", text: "Delete") end context "and admin clicks No for user approval" do @@ -45,7 +45,7 @@ end it "shows Yes instead of No button" do - expect(page).to have_link('Yes', :href => remove_approval_user_path(unapproved_user)) + expect(page).to have_link('Yes', href: remove_approval_user_path(unapproved_user)) end context "and the admin clicks No for user approval for same user" do From 5c23318bbc331a2661e79264f72e4ffaa2722bd5 Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 21:46:09 -0700 Subject: [PATCH 12/14] Change it blocks to refer to feature subject instead of context subject --- spec/features/users_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index bca73be..66ca4ee 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -12,7 +12,7 @@ expect(page).to have_table("users_table") end - it "sees a table with proper headers and admin row data" do + it "displays a table with proper headers and admin row data" do page.find("#user_#{admin.id} td:nth-of-type(1)", text: admin.name) page.find("#user_#{admin.id} td:nth-of-type(2)", text: admin.created_at_string) page.find("#user_#{admin.id} td:nth-of-type(3)", text: "Yes") @@ -21,7 +21,7 @@ page.find("#user_#{admin.id} td:nth-of-type(6)", text: "Delete") end - it "sees a table with proper headers and user row data" do + it "displays a table with proper headers and user row data" do page.find("#user_#{users.first.id} td:nth-of-type(1)", text: users.first.name) page.find("#user_#{users.first.id} td:nth-of-type(2)", text: users.first.created_at_string) page.find("#user_#{users.first.id} td:nth-of-type(3)", text: "Yes") From e989528631de642bac64968b07a7a1329d9d1e34 Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 21:54:38 -0700 Subject: [PATCH 13/14] Remove default approval from user factory --- spec/factories/users.rb | 1 - spec/features/users_spec.rb | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/factories/users.rb b/spec/factories/users.rb index d0a52c1..80a90ac 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -7,6 +7,5 @@ sequence :name do |n| "Fake User#{n}" end - approval_at "2017-02-25 23:28:13" end end diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 66ca4ee..a5c5157 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -3,8 +3,8 @@ context "when an admin visits the users index" do let!(:admin) { login_new_admin_user } - let!(:users) { create_list(:user, 2) } - let!(:unapproved_user) { create(:user, approval_at: nil)} + let!(:users) { create_list(:user, 2, approval_at: "01/01/2001") } + let!(:unapproved_user) { create(:user) } before { visit users_index_path } From 47f03434ab5ff695c10506365dc9621886886cd4 Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 1 Mar 2017 22:14:02 -0700 Subject: [PATCH 14/14] Add minor stylistic changes --- spec/factories/users.rb | 8 ++------ spec/features/.DS_Store | Bin 6148 -> 0 bytes spec/support/feature_helpers.rb | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 spec/features/.DS_Store diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 80a90ac..16dba07 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,11 +1,7 @@ FactoryGirl.define do factory :user do provider "google_oauth2" - sequence :uid do |n| - n - end - sequence :name do |n| - "Fake User#{n}" - end + sequence(:uid) { |n| n } + sequence(:name) { |n| "Fake User#{n}" } end end diff --git a/spec/features/.DS_Store b/spec/features/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0