mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-29 20:25:09 -04:00
Merge pull request #1157 from Br3nda/bw/rubocop-hash-braces
Removed unnecesary braces on hash args
This commit is contained in:
@@ -173,33 +173,6 @@ Style/BlockEndNewline:
|
||||
- 'spec/models/member_spec.rb'
|
||||
- 'spec/models/planting_spec.rb'
|
||||
|
||||
# Offense count: 75
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: braces, no_braces, context_dependent
|
||||
Style/BracesAroundHashParameters:
|
||||
Exclude:
|
||||
- 'app/controllers/admin/orders_controller.rb'
|
||||
- 'app/controllers/crops_controller.rb'
|
||||
- 'app/controllers/posts_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'config/environments/test.rb'
|
||||
- 'spec/controllers/admin/orders_controller_spec.rb'
|
||||
- 'spec/controllers/comments_controller_spec.rb'
|
||||
- 'spec/controllers/harvests_controller_spec.rb'
|
||||
- 'spec/controllers/member_controller_spec.rb'
|
||||
- 'spec/controllers/notifications_controller_spec.rb'
|
||||
- 'spec/controllers/order_items_controller_spec.rb'
|
||||
- 'spec/controllers/orders_controller_spec.rb'
|
||||
- 'spec/controllers/places_controller_spec.rb'
|
||||
- 'spec/controllers/plantings_controller_spec.rb'
|
||||
- 'spec/controllers/posts_controller_spec.rb'
|
||||
- 'spec/controllers/scientific_names_controller_spec.rb'
|
||||
- 'spec/controllers/seeds_controller_spec.rb'
|
||||
- 'spec/lib/actions/oauth_signup_action_spec.rb'
|
||||
- 'spec/views/notifier/notify.html.haml_spec.rb'
|
||||
- 'spec/views/photos/new.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: nested, compact
|
||||
|
||||
@@ -8,7 +8,7 @@ class Admin::OrdersController < ApplicationController
|
||||
|
||||
def search
|
||||
authorize! :manage, :all
|
||||
@orders = Order.search({ by: params[:search_by], for: params[:search_text] })
|
||||
@orders = Order.search(by: params[:search_by], for: params[:search_text])
|
||||
|
||||
if @orders.empty?
|
||||
flash[:alert] = "Couldn't find order with #{params[:search_by]} = #{params[:search_text]}"
|
||||
|
||||
@@ -10,7 +10,7 @@ class CropsController < ApplicationController
|
||||
def index
|
||||
@sort = params[:sort]
|
||||
@crops = if @sort == 'alpha'
|
||||
Crop.includes(:scientific_names, { plantings: :photos })
|
||||
Crop.includes(:scientific_names, plantings: :photos)
|
||||
else
|
||||
popular_crops
|
||||
end
|
||||
@@ -74,7 +74,7 @@ class CropsController < ApplicationController
|
||||
# GET /crops/1
|
||||
# GET /crops/1.json
|
||||
def show
|
||||
@crop = Crop.includes(:scientific_names, { plantings: :photos }).find(params[:id])
|
||||
@crop = Crop.includes(:scientific_names, plantings: :photos).find(params[:id])
|
||||
@posts = @crop.posts.paginate(page: params[:page])
|
||||
|
||||
respond_to do |format|
|
||||
@@ -192,7 +192,7 @@ class CropsController < ApplicationController
|
||||
private
|
||||
|
||||
def popular_crops
|
||||
Crop.popular.includes(:scientific_names, { plantings: :photos })
|
||||
Crop.popular.includes(:scientific_names, plantings: :photos)
|
||||
end
|
||||
|
||||
def recreate_names(param_name, name_type)
|
||||
|
||||
@@ -8,9 +8,9 @@ class PostsController < ApplicationController
|
||||
def index
|
||||
@author = Member.find_by(slug: params[:author])
|
||||
@posts = if @author
|
||||
@author.posts.includes(:author, { comments: :author }).paginate(page: params[:page])
|
||||
@author.posts.includes(:author, comments: :author).paginate(page: params[:page])
|
||||
else
|
||||
Post.includes(:author, { comments: :author }).paginate(page: params[:page])
|
||||
Post.includes(:author, comments: :author).paginate(page: params[:page])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
@@ -23,7 +23,7 @@ class PostsController < ApplicationController
|
||||
# GET /posts/1
|
||||
# GET /posts/1.json
|
||||
def show
|
||||
@post = Post.includes(:author, { comments: :author }).find(params[:id])
|
||||
@post = Post.includes(:author, comments: :author).find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
|
||||
@@ -70,10 +70,8 @@ module ApplicationHelper
|
||||
return uri.to_s
|
||||
end
|
||||
|
||||
Gravatar.new(member.email).image_url({
|
||||
size: size,
|
||||
default: :identicon
|
||||
})
|
||||
Gravatar.new(member.email).image_url(size: size,
|
||||
default: :identicon)
|
||||
end
|
||||
|
||||
# Returns a string with the quantity and the right pluralization for a
|
||||
|
||||
@@ -112,17 +112,15 @@ end
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
# Fake the omniauth
|
||||
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({
|
||||
provider: 'facebook',
|
||||
uid: '123545',
|
||||
info: {
|
||||
name: "John Testerson",
|
||||
nickname: 'JohnnyT',
|
||||
email: 'example.oauth.facebook@example.com',
|
||||
image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
|
||||
},
|
||||
credentials: {
|
||||
token: "token",
|
||||
secret: "donttell"
|
||||
}
|
||||
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(provider: 'facebook',
|
||||
uid: '123545',
|
||||
info: {
|
||||
name: "John Testerson",
|
||||
nickname: 'JohnnyT',
|
||||
email: 'example.oauth.facebook@example.com',
|
||||
image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
|
||||
},
|
||||
credentials: {
|
||||
token: "token",
|
||||
secret: "donttell"
|
||||
})
|
||||
|
||||
@@ -18,12 +18,12 @@ describe Admin::OrdersController do
|
||||
describe "GET search" do
|
||||
it "assigns @orders" do
|
||||
order = FactoryGirl.create(:order)
|
||||
get :search, { search_by: 'order_id', search_text: order.id }
|
||||
get :search, search_by: 'order_id', search_text: order.id
|
||||
assigns(:orders).should eq([order])
|
||||
end
|
||||
|
||||
it "sets an error message if nothing found" do
|
||||
get :search, { search_by: 'order_id', search_text: 'foo' }
|
||||
get :search, search_by: 'order_id', search_text: 'foo'
|
||||
flash[:alert].should match /Couldn't find order with/
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,14 +36,14 @@ describe CommentsController do
|
||||
describe "GET new" do
|
||||
it "picks up post from params" do
|
||||
post = FactoryGirl.create(:post)
|
||||
get :new, { post_id: post.id }
|
||||
get :new, post_id: post.id
|
||||
assigns(:post).should eq(post)
|
||||
end
|
||||
|
||||
it "assigns the old comments as @comments" do
|
||||
post = FactoryGirl.create(:post)
|
||||
old_comment = FactoryGirl.create(:comment, post: post)
|
||||
get :new, { post_id: post.id }
|
||||
get :new, post_id: post.id
|
||||
assigns(:comments).should eq [old_comment]
|
||||
end
|
||||
|
||||
@@ -58,7 +58,7 @@ describe CommentsController do
|
||||
post = FactoryGirl.create(:post)
|
||||
old_comment = FactoryGirl.create(:comment, post: post)
|
||||
comment = FactoryGirl.create(:comment, post: post, author: @member)
|
||||
get :edit, { id: comment.to_param }
|
||||
get :edit, id: comment.to_param
|
||||
assigns(:comments).should eq([comment, old_comment])
|
||||
end
|
||||
end
|
||||
@@ -67,7 +67,7 @@ describe CommentsController do
|
||||
describe "with valid params" do
|
||||
it "redirects to the comment's post" do
|
||||
comment = Comment.create! valid_attributes
|
||||
put :update, { id: comment.to_param, comment: valid_attributes }
|
||||
put :update, id: comment.to_param, comment: valid_attributes
|
||||
response.should redirect_to(comment.post)
|
||||
end
|
||||
end
|
||||
@@ -77,7 +77,7 @@ describe CommentsController do
|
||||
it "redirects to the post the comment was on" do
|
||||
comment = Comment.create! valid_attributes
|
||||
post = comment.post
|
||||
delete :destroy, { id: comment.to_param }
|
||||
delete :destroy, id: comment.to_param
|
||||
response.should redirect_to(post)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,19 +39,19 @@ describe HarvestsController do
|
||||
end
|
||||
|
||||
it "picks up owner from params and shows owner's harvests only" do
|
||||
get :index, { owner: @member1.slug }
|
||||
get :index, owner: @member1.slug
|
||||
assigns(:owner).should eq @member1
|
||||
assigns(:harvests).should eq [@harvest1]
|
||||
end
|
||||
|
||||
it "picks up crop from params and shows the harvests for the crop only" do
|
||||
get :index, { crop: @maize.name }
|
||||
get :index, crop: @maize.name
|
||||
assigns(:crop).should eq @maize
|
||||
assigns(:harvests).should eq [@harvest2]
|
||||
end
|
||||
|
||||
it "generates a csv" do
|
||||
get :index, { format: "csv" }
|
||||
get :index, format: "csv"
|
||||
response.status.should eq 200
|
||||
end
|
||||
end
|
||||
@@ -59,7 +59,7 @@ describe HarvestsController do
|
||||
describe "GET show" do
|
||||
it "assigns the requested harvest as @harvest" do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
get :show, { id: harvest.to_param }
|
||||
get :show, id: harvest.to_param
|
||||
assigns(:harvest).should eq(harvest)
|
||||
end
|
||||
end
|
||||
@@ -74,7 +74,7 @@ describe HarvestsController do
|
||||
describe "GET edit" do
|
||||
it "assigns the requested harvest as @harvest" do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
get :edit, { id: harvest.to_param }
|
||||
get :edit, id: harvest.to_param
|
||||
assigns(:harvest).should eq(harvest)
|
||||
end
|
||||
end
|
||||
@@ -83,24 +83,24 @@ describe HarvestsController do
|
||||
describe "with valid params" do
|
||||
it "creates a new Harvest" do
|
||||
expect {
|
||||
post :create, { harvest: valid_attributes }
|
||||
post :create, harvest: valid_attributes
|
||||
}.to change(Harvest, :count).by(1)
|
||||
end
|
||||
|
||||
it "assigns a newly created harvest as @harvest" do
|
||||
post :create, { harvest: valid_attributes }
|
||||
post :create, harvest: valid_attributes
|
||||
assigns(:harvest).should be_a(Harvest)
|
||||
assigns(:harvest).should be_persisted
|
||||
end
|
||||
|
||||
it "redirects to the created harvest" do
|
||||
post :create, { harvest: valid_attributes }
|
||||
post :create, harvest: valid_attributes
|
||||
response.should redirect_to(Harvest.last)
|
||||
end
|
||||
|
||||
it "links to planting" do
|
||||
planting = FactoryGirl.create(:planting, owner_id: member.id)
|
||||
post :create, { harvest: valid_attributes.merge(planting_id: planting.id) }
|
||||
post :create, harvest: valid_attributes.merge(planting_id: planting.id)
|
||||
expect(Harvest.last.planting.id).to eq(planting.id)
|
||||
end
|
||||
end
|
||||
@@ -109,14 +109,14 @@ describe HarvestsController do
|
||||
it "assigns a newly created but unsaved harvest as @harvest" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Harvest.any_instance.stub(:save).and_return(false)
|
||||
post :create, { harvest: { "crop_id" => "invalid value" } }
|
||||
post :create, harvest: { "crop_id" => "invalid value" }
|
||||
assigns(:harvest).should be_a_new(Harvest)
|
||||
end
|
||||
|
||||
it "re-renders the 'new' template" do
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Harvest.any_instance.stub(:save).and_return(false)
|
||||
post :create, { harvest: { "crop_id" => "invalid value" } }
|
||||
post :create, harvest: { "crop_id" => "invalid value" }
|
||||
response.should render_template("new")
|
||||
end
|
||||
end
|
||||
@@ -125,7 +125,7 @@ describe HarvestsController do
|
||||
let(:harvest) { FactoryGirl.create(:harvest) }
|
||||
it "does not save planting_id" do
|
||||
allow(Harvest).to receive(:new).and_return(harvest)
|
||||
post :create, { harvest: valid_attributes.merge(planting_id: not_my_planting.id) }
|
||||
post :create, harvest: valid_attributes.merge(planting_id: not_my_planting.id)
|
||||
expect(harvest.planting_id).to eq(nil)
|
||||
end
|
||||
end
|
||||
@@ -139,19 +139,19 @@ describe HarvestsController do
|
||||
# specifies that the Harvest created on the previous line
|
||||
# receives the :update message with whatever params are
|
||||
# submitted in the request.
|
||||
Harvest.any_instance.should_receive(:update).with({ "crop_id" => "1", "owner_id": member.id })
|
||||
put :update, { id: harvest.to_param, harvest: { "crop_id" => "1" } }
|
||||
Harvest.any_instance.should_receive(:update).with("crop_id" => "1", "owner_id": member.id)
|
||||
put :update, id: harvest.to_param, harvest: { "crop_id" => "1" }
|
||||
end
|
||||
|
||||
it "assigns the requested harvest as @harvest" do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
put :update, { id: harvest.to_param, harvest: valid_attributes }
|
||||
put :update, id: harvest.to_param, harvest: valid_attributes
|
||||
assigns(:harvest).should eq(harvest)
|
||||
end
|
||||
|
||||
it "redirects to the harvest" do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
put :update, { id: harvest.to_param, harvest: valid_attributes }
|
||||
put :update, id: harvest.to_param, harvest: valid_attributes
|
||||
response.should redirect_to(harvest)
|
||||
end
|
||||
end
|
||||
@@ -161,7 +161,7 @@ describe HarvestsController do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Harvest.any_instance.stub(:save).and_return(false)
|
||||
put :update, { id: harvest.to_param, harvest: { "crop_id" => "invalid value" } }
|
||||
put :update, id: harvest.to_param, harvest: { "crop_id" => "invalid value" }
|
||||
assigns(:harvest).should eq(harvest)
|
||||
end
|
||||
|
||||
@@ -169,7 +169,7 @@ describe HarvestsController do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
# Trigger the behavior that occurs when invalid params are submitted
|
||||
Harvest.any_instance.stub(:save).and_return(false)
|
||||
put :update, { id: harvest.to_param, harvest: { "crop_id" => "invalid value" } }
|
||||
put :update, id: harvest.to_param, harvest: { "crop_id" => "invalid value" }
|
||||
response.should render_template("edit")
|
||||
end
|
||||
end
|
||||
@@ -178,7 +178,7 @@ describe HarvestsController do
|
||||
let(:harvest) { FactoryGirl.create(:harvest) }
|
||||
it "does not save planting_id" do
|
||||
allow(Harvest).to receive(:new).and_return(harvest)
|
||||
put :update, { id: harvest.to_param, harvest: valid_attributes.merge(planting_id: not_my_planting.id) }
|
||||
put :update, id: harvest.to_param, harvest: valid_attributes.merge(planting_id: not_my_planting.id)
|
||||
expect(harvest.planting_id).to eq(nil)
|
||||
end
|
||||
end
|
||||
@@ -188,13 +188,13 @@ describe HarvestsController do
|
||||
it "destroys the requested harvest" do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, { id: harvest.to_param }
|
||||
delete :destroy, id: harvest.to_param
|
||||
}.to change(Harvest, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the harvests list" do
|
||||
harvest = Harvest.create! valid_attributes
|
||||
delete :destroy, { id: harvest.to_param }
|
||||
delete :destroy, id: harvest.to_param
|
||||
response.should redirect_to(harvests_url)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,38 +36,38 @@ describe MembersController do
|
||||
|
||||
describe "GET show" do
|
||||
it "provides JSON for member profile" do
|
||||
get :show, { id: @member.id, format: 'json' }
|
||||
get :show, id: @member.id, format: 'json'
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it "assigns @posts with the member's posts" do
|
||||
get :show, { id: @member.id }
|
||||
get :show, id: @member.id
|
||||
assigns(:posts).should eq(@posts)
|
||||
end
|
||||
|
||||
it "assigns @twitter_auth" do
|
||||
get :show, { id: @member.id }
|
||||
get :show, id: @member.id
|
||||
assigns(:twitter_auth).should eq(@twitter_auth)
|
||||
end
|
||||
|
||||
it "assigns @flickr_auth" do
|
||||
get :show, { id: @member.id }
|
||||
get :show, id: @member.id
|
||||
assigns(:flickr_auth).should eq(@flickr_auth)
|
||||
end
|
||||
|
||||
it "doesn't show completely nonsense members" do
|
||||
lambda { get :show, { id: 9999 } }.should raise_error(ActiveRecord::RecordNotFound)
|
||||
lambda { get :show, id: 9999 }.should raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it "doesn't show unconfirmed members" do
|
||||
@member2 = FactoryGirl.create(:unconfirmed_member)
|
||||
lambda { get :show, { id: @member2.id } }.should raise_error(ActiveRecord::RecordNotFound)
|
||||
lambda { get :show, id: @member2.id }.should raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET member's RSS feed" do
|
||||
it "returns an RSS feed" do
|
||||
get :show, { id: @member.to_param, format: "rss" }
|
||||
get :show, id: @member.to_param, format: "rss"
|
||||
response.should be_success
|
||||
response.should render_template("members/show")
|
||||
response.content_type.should eq("application/rss+xml")
|
||||
|
||||
@@ -51,14 +51,14 @@ describe NotificationsController do
|
||||
describe "GET show" do
|
||||
it "assigns the requested notification as @notification" do
|
||||
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
|
||||
get :show, { id: notification.to_param }
|
||||
get :show, id: notification.to_param
|
||||
assigns(:notification).should eq(notification)
|
||||
end
|
||||
|
||||
it "assigns the reply link for a post comment" do
|
||||
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
|
||||
|
||||
get :show, { id: notification.to_param }
|
||||
get :show, id: notification.to_param
|
||||
assigns(:reply_link).should_not be_nil
|
||||
assigns(:reply_link).should eq new_comment_url(
|
||||
post_id: notification.post.id
|
||||
@@ -67,7 +67,7 @@ describe NotificationsController do
|
||||
|
||||
it "marks notifications as read" do
|
||||
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
|
||||
get :show, { id: notification.to_param }
|
||||
get :show, id: notification.to_param
|
||||
# we need to fetch it from the db again, can't test against the old one
|
||||
n = Notification.find(notification.id)
|
||||
n.read.should eq true
|
||||
@@ -77,7 +77,7 @@ describe NotificationsController do
|
||||
describe "GET reply" do
|
||||
it "marks notifications as read" do
|
||||
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
|
||||
get :reply, { id: notification.to_param }
|
||||
get :reply, id: notification.to_param
|
||||
# we need to fetch it from the db again, can't test against the old one
|
||||
n = Notification.find(notification.id)
|
||||
n.read.should eq true
|
||||
@@ -87,7 +87,7 @@ describe NotificationsController do
|
||||
describe "GET new" do
|
||||
it "assigns a recipient" do
|
||||
@recipient = FactoryGirl.create(:member)
|
||||
get :new, { recipient_id: @recipient.id }
|
||||
get :new, recipient_id: @recipient.id
|
||||
assigns(:recipient).should be_an_instance_of(Member)
|
||||
end
|
||||
end
|
||||
@@ -96,7 +96,7 @@ describe NotificationsController do
|
||||
describe "with valid params" do
|
||||
it "redirects to the recipient's profile" do
|
||||
@recipient = FactoryGirl.create(:member)
|
||||
post :create, { notification: { recipient_id: @recipient.id, subject: 'foo' } }
|
||||
post :create, notification: { recipient_id: @recipient.id, subject: 'foo' }
|
||||
response.should redirect_to(notifications_path)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,11 +30,11 @@ describe OrderItemsController do
|
||||
describe "POST create" do
|
||||
it "redirects to order" do
|
||||
@order = FactoryGirl.create(:order, member: @member)
|
||||
post :create, { order_item: {
|
||||
post :create, order_item: {
|
||||
order_id: @order.id,
|
||||
product_id: @product.id,
|
||||
price: @product.min_price
|
||||
} }
|
||||
}
|
||||
response.should redirect_to(OrderItem.last.order)
|
||||
end
|
||||
|
||||
@@ -43,10 +43,10 @@ describe OrderItemsController do
|
||||
sign_in @member
|
||||
@product = FactoryGirl.create(:product)
|
||||
expect {
|
||||
post :create, { order_item: {
|
||||
post :create, order_item: {
|
||||
product_id: @product.id,
|
||||
price: @product.min_price
|
||||
} }
|
||||
}
|
||||
}.to change(Order, :count).by(1)
|
||||
OrderItem.last.order.should be_an_instance_of Order
|
||||
end
|
||||
@@ -56,11 +56,11 @@ describe OrderItemsController do
|
||||
@order = FactoryGirl.create(:order, member: @member)
|
||||
@product = FactoryGirl.create(:product, min_price: 1)
|
||||
expect {
|
||||
post :create, { order_item: {
|
||||
post :create, order_item: {
|
||||
order_id: @order.id,
|
||||
product_id: @product.id,
|
||||
price: 3.33
|
||||
} }
|
||||
}
|
||||
}.to change(OrderItem, :count).by(1)
|
||||
OrderItem.last.price.should eq 333
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ describe OrdersController do
|
||||
member = FactoryGirl.create(:member)
|
||||
sign_in member
|
||||
order = Order.create!(member_id: member.id)
|
||||
get :checkout, { id: order.to_param, referral_code: 'FOOBAR' }
|
||||
get :checkout, id: order.to_param, referral_code: 'FOOBAR'
|
||||
order.reload
|
||||
order.referral_code.should eq 'FOOBAR'
|
||||
end
|
||||
@@ -37,7 +37,7 @@ describe OrdersController do
|
||||
member = FactoryGirl.create(:member)
|
||||
sign_in member
|
||||
order = Order.create!(member_id: member.id)
|
||||
get :checkout, { id: order.to_param }
|
||||
get :checkout, id: order.to_param
|
||||
response.status.should eq 302
|
||||
response.redirect_url.should match /paypal\.com/
|
||||
end
|
||||
@@ -48,7 +48,7 @@ describe OrdersController do
|
||||
member = FactoryGirl.create(:member)
|
||||
sign_in member
|
||||
order = Order.create!(member_id: member.id)
|
||||
get :complete, { id: order.to_param }
|
||||
get :complete, id: order.to_param
|
||||
assigns(:order).should eq(order)
|
||||
end
|
||||
end
|
||||
@@ -58,7 +58,7 @@ describe OrdersController do
|
||||
member = FactoryGirl.create(:member)
|
||||
sign_in member
|
||||
order = Order.create!(member_id: member.id)
|
||||
delete :destroy, { id: order.id }
|
||||
delete :destroy, id: order.id
|
||||
response.should redirect_to(shop_url)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,19 +24,19 @@ describe PlacesController do
|
||||
end
|
||||
|
||||
it "assigns place name" do
|
||||
get :show, { place: @member_london.location }
|
||||
get :show, place: @member_london.location
|
||||
assigns(:place).should eq @member_london.location
|
||||
end
|
||||
|
||||
it "assigns nearby members" do
|
||||
get :show, { place: @member_london.location }
|
||||
get :show, place: @member_london.location
|
||||
assigns(:nearby_members).should eq [@member_london, @member_south_pole]
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET search" do
|
||||
it "redirects to the new place" do
|
||||
get :search, { new_place: "foo" }
|
||||
get :search, new_place: "foo"
|
||||
response.should redirect_to place_path("foo")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,13 +38,13 @@ describe PlantingsController do
|
||||
end
|
||||
|
||||
it "picks up owner from params and shows owner's plantings only" do
|
||||
get :index, { owner: @member1.slug }
|
||||
get :index, owner: @member1.slug
|
||||
assigns(:owner).should eq @member1
|
||||
assigns(:plantings).should eq [@planting1]
|
||||
end
|
||||
|
||||
it "picks up crop from params and shows the plantings for the crop only" do
|
||||
get :index, { crop: @maize.name }
|
||||
get :index, crop: @maize.name
|
||||
assigns(:crop).should eq @maize
|
||||
assigns(:plantings).should eq [@planting2]
|
||||
end
|
||||
@@ -53,7 +53,7 @@ describe PlantingsController do
|
||||
describe "GET new" do
|
||||
it "picks up crop from params" do
|
||||
crop = FactoryGirl.create(:crop)
|
||||
get :new, { crop_id: crop.id }
|
||||
get :new, crop_id: crop.id
|
||||
assigns(:crop).should eq(crop)
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ describe PlantingsController do
|
||||
it "picks up garden from params" do
|
||||
member = FactoryGirl.create(:member)
|
||||
garden = FactoryGirl.create(:garden, owner: member)
|
||||
get :new, { garden_id: garden.id }
|
||||
get :new, garden_id: garden.id
|
||||
assigns(:garden).should eq(garden)
|
||||
end
|
||||
|
||||
@@ -80,7 +80,7 @@ describe PlantingsController do
|
||||
end
|
||||
|
||||
it "sets the owner automatically" do
|
||||
post :create, { planting: valid_attributes }
|
||||
post :create, planting: valid_attributes
|
||||
assigns(:planting).owner.should eq subject.current_member
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ describe PostsController do
|
||||
describe "GET RSS feed for individual post" do
|
||||
it "returns an RSS feed" do
|
||||
post = Post.create! valid_attributes
|
||||
get :show, { format: "rss", id: post.slug }
|
||||
get :show, format: "rss", id: post.slug
|
||||
response.should be_success
|
||||
response.should render_template("posts/show")
|
||||
response.content_type.should eq("application/rss+xml")
|
||||
|
||||
@@ -25,7 +25,7 @@ describe ScientificNamesController do
|
||||
|
||||
describe "GET new" do
|
||||
it "assigns crop if specified" do
|
||||
get :new, { crop_id: 1 }
|
||||
get :new, crop_id: 1
|
||||
assigns(:crop).should be_an_instance_of Crop
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ describe SeedsController do
|
||||
describe "GET index" do
|
||||
it "picks up owner from params" do
|
||||
owner = FactoryGirl.create(:member)
|
||||
get :index, { owner: owner.slug }
|
||||
get :index, owner: owner.slug
|
||||
assigns(:owner).should eq(owner)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,19 +8,17 @@ describe 'Growstuff::OauthSignupAction' do
|
||||
|
||||
context 'with a valid authentication' do
|
||||
before :each do
|
||||
@auth = OmniAuth::AuthHash.new({
|
||||
'provider' => 'facebook',
|
||||
'uid' => '123545',
|
||||
'info' => {
|
||||
'name' => "John Testerson's Brother",
|
||||
'nickname' => 'JohnnyB',
|
||||
'email' => 'example.oauth.facebook@example.com',
|
||||
'image' => 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
|
||||
},
|
||||
'credentials' => {
|
||||
'token' => "token",
|
||||
'secret' => "donttell"
|
||||
}
|
||||
@auth = OmniAuth::AuthHash.new('provider' => 'facebook',
|
||||
'uid' => '123545',
|
||||
'info' => {
|
||||
'name' => "John Testerson's Brother",
|
||||
'nickname' => 'JohnnyB',
|
||||
'email' => 'example.oauth.facebook@example.com',
|
||||
'image' => 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
|
||||
},
|
||||
'credentials' => {
|
||||
'token' => "token",
|
||||
'secret' => "donttell"
|
||||
})
|
||||
end
|
||||
|
||||
@@ -76,11 +74,9 @@ describe 'Growstuff::OauthSignupAction' do
|
||||
@auth['info']['email'] = 'never.used.oauth@yahoo.com'
|
||||
|
||||
Member.where(email: @auth['info']['email']).delete_all
|
||||
@existing_member = create :member, {
|
||||
email: @auth['info']['email'],
|
||||
login_name: 'existing',
|
||||
preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg'
|
||||
}
|
||||
@existing_member = create :member, email: @auth['info']['email'],
|
||||
login_name: 'existing',
|
||||
preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg'
|
||||
|
||||
@member = @action.find_or_create_from_authorization(@auth)
|
||||
@authentication = @action.establish_authentication(@auth, @member)
|
||||
@@ -122,18 +118,14 @@ describe 'Growstuff::OauthSignupAction' do
|
||||
Member.where(email: @auth['info']['email']).delete_all
|
||||
Authentication.delete_all
|
||||
|
||||
@existing_member = create :member, {
|
||||
email: @auth['info']['email'],
|
||||
login_name: 'schrodingerscat',
|
||||
preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg'
|
||||
}
|
||||
@existing_member = create :member, email: @auth['info']['email'],
|
||||
login_name: 'schrodingerscat',
|
||||
preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg'
|
||||
|
||||
@existing_authentication = @existing_member.authentications.create({
|
||||
provider: 'facebook',
|
||||
uid: '123545',
|
||||
name: "John Testerson's Brother",
|
||||
member_id: @existing_member.id
|
||||
})
|
||||
@existing_authentication = @existing_member.authentications.create(provider: 'facebook',
|
||||
uid: '123545',
|
||||
name: "John Testerson's Brother",
|
||||
member_id: @existing_member.id)
|
||||
|
||||
@member = @action.find_or_create_from_authorization(@auth)
|
||||
@authentication = @action.establish_authentication(@auth, @member)
|
||||
|
||||
@@ -40,8 +40,8 @@ describe 'notifier/notify.html.haml', type: "view" do
|
||||
|
||||
it 'should have fully qualified URLs' do
|
||||
# lots of lovely fully qualified URLs
|
||||
assert_select "a[href^='http']", { minimum: 4 }
|
||||
assert_select "a[href^='http']", minimum: 4
|
||||
# no relative URLs starting with /
|
||||
assert_select "a[href^='/']", { count: 0 }
|
||||
assert_select "a[href^='/']", count: 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ describe "photos/new" do
|
||||
|
||||
context "user has photosets" do
|
||||
before(:each) do
|
||||
assign(:sets, { "foo" => "bar" }) # Hash of names => IDs
|
||||
assign(:sets, "foo" => "bar") # Hash of names => IDs
|
||||
end
|
||||
|
||||
it "shows a dropdown with sets from Flickr" do
|
||||
|
||||
Reference in New Issue
Block a user