1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Mock photo request for feature spec

This commit is contained in:
Daniel Barber 2015-10-29 18:01:17 +00:00
parent 6658c03d66
commit 1b326fd0a0
4 changed files with 14 additions and 1 deletions

View File

@ -67,3 +67,4 @@ gem 'skylight'
gem 'slugtastic'
gem 'squeel'
gem 'unf'
gem 'webmock'

View File

@ -99,6 +99,8 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
crack (0.4.2)
safe_yaml (~> 1.0.0)
database_cleaner (1.5.0)
datetime_picker_rails (0.0.4)
momentjs-rails (>= 2.8.1)
@ -280,6 +282,7 @@ GEM
ruby-progressbar (1.7.5)
ruby_parser (3.7.1)
sexp_processor (~> 4.1)
safe_yaml (1.0.4)
sass (3.4.19)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
@ -330,6 +333,9 @@ GEM
unf_ext (0.0.7.1)
warden (1.2.3)
rack (>= 1.0)
webmock (1.21.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
websocket-driver (0.6.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
@ -382,6 +388,7 @@ DEPENDENCIES
squeel
uglifier
unf
webmock
BUNDLED WITH
1.10.6

View File

@ -10,8 +10,10 @@ feature 'visitor navigates site' do
end
it 'increments the view counter when an image is displayed', js: true do
stub_request(:get, 'http://res.cloudinary.com/danbarber/image/upload/photo.jpg')
category = create(:category)
photo = create(:photo, featured: true, categories: [category])
photo = create(:photo, image_cloudinary_id: 'photo', featured: true, categories: [category])
visit root_path

View File

@ -4,6 +4,7 @@ require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/poltergeist'
require 'webmock/rspec'
# For code coverage
require 'simplecov'
@ -16,6 +17,8 @@ Capybara.javascript_driver = :poltergeist
# in spec/support/ and its subdirectories.
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
WebMock.disable_net_connect!(:allow_localhost => true)
RSpec.configure do |config|
# ## Mock Framework
#