Auto corrected by following Lint Ruby RSpecEmptyLine

This commit is contained in:
Awesome Code
2019-03-12 22:51:12 +00:00
committed by Brenda Wallace
parent da997ae538
commit 5145ead93b
8 changed files with 20 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ describe CommentsController do
before { get :new, params: { post_id: post.id } }
let(:old_comment) { FactoryBot.create(:comment, post: post) }
it "picks up post from params" do
expect(assigns(:post)).to eq(post)
end

View File

@@ -11,11 +11,14 @@ describe CropsController do
describe 'fetches the crop wrangler homepage' do
context 'anonymous' do
before { get :wrangle }
it { is_expected.not_to be_success }
end
context 'wrangler' do
include_context 'login as wrangler'
before { get :wrangle }
it { is_expected.to be_success }
it { is_expected.to render_template("crops/wrangle") }
it { expect(assigns[:crop_wranglers]).to eq(Role.crop_wranglers) }
@@ -28,6 +31,7 @@ describe CropsController do
context 'wrangler' do
include_context 'login as wrangler'
before { get :hierarchy }
it { is_expected.to be_success }
it { is_expected.to render_template("crops/hierarchy") }
end
@@ -55,13 +59,17 @@ describe CropsController do
describe 'DELETE destroy' do
let!(:crop) { FactoryBot.create :crop }
subject { delete :destroy, params: { slug: crop.to_param } }
context 'not logged in' do
it { expect { subject }.not_to change { Crop.count } }
end
context 'logged in as member' do
it { expect { subject }.not_to change { Crop.count } }
end
context 'wrangler' do
include_context 'login as wrangler'
it { expect { subject }.to change { Crop.count }.by -1 }

View File

@@ -10,6 +10,7 @@ describe LikesController do
describe "POST create" do
before { post :create, params: { post_id: blogpost.id, format: :json } }
it { expect(response.content_type).to eq "application/json" }
it { expect(Like.last.likeable_id).to eq(blogpost.id) }

View File

@@ -8,7 +8,9 @@ describe PhotosController do
describe 'GET index' do
describe 'all photos' do
let!(:photo) { FactoryBot.create :photo }
before { get :index }
it { expect(assigns(:photos)).to eq [photo] }
end
@@ -22,6 +24,7 @@ describe PhotosController do
planting.photos << crop_photo
get :index, params: { crop_slug: crop.to_param }
end
it { expect(assigns(:crop)).to eq crop }
it { expect(assigns(:photos)).to eq [crop_photo] }
end

View File

@@ -15,6 +15,7 @@ feature "show photo page" do
planting.photos << photo
visit photo_path(photo)
end
it {
expect(page).to have_link "#{planting.crop.name} planting in #{planting.garden.name} by #{planting.owner}",
href: planting_path(planting)
@@ -32,6 +33,7 @@ feature "show photo page" do
harvest.photos << photo
visit photo_path(photo)
end
it { expect(page).to have_link "#{harvest.crop.name} harvest by #{harvest.owner}", href: harvest_path(harvest) }
it { expect(page).to have_link harvest.crop.name }
end
@@ -46,6 +48,7 @@ feature "show photo page" do
garden.photos << photo
visit photo_path(photo)
end
it { expect(page).to have_link "garden named \"#{garden.name}\" by #{garden.owner}", href: garden_path(garden) }
end
end
@@ -59,6 +62,7 @@ feature "show photo page" do
seed.photos << photo
visit photo_path(photo)
end
it { expect(page).to have_link "#{seed.crop.name} seeds belonging to #{seed.owner}", href: seed_path(seed) }
it { expect(page).to have_link seed.crop.name }
end

View File

@@ -4,6 +4,7 @@ feature "signout" do
let(:member) { create :member }
let(:path) {}
scenario "redirect to previous page after signout" do
visit crops_path # some random page
click_link 'Sign in'

View File

@@ -4,6 +4,7 @@ describe Crop do
let(:pp2) { FactoryBot.create(:plant_part) }
let(:pp1) { FactoryBot.create(:plant_part) }
let(:maize) { FactoryBot.create(:maize) }
context 'all fields present' do
let(:crop) { FactoryBot.create(:tomato) }

View File

@@ -139,6 +139,7 @@ describe Photo do
let(:seed_crop) { FactoryBot.create :crop }
let!(:seed) { FactoryBot.create :seed, owner: member, crop: seed_crop }
let!(:seed_photo) { FactoryBot.create :photo, owner: member }
before do
harvest.photos << harvest_photo
planting.photos << planting_photo