mirror of
https://github.com/danbee/my-images
synced 2025-03-04 08:49:05 +00:00
WIP: Add capybara and start image upload spec
This commit is contained in:
parent
4ef3792bad
commit
881e000e1f
1
Gemfile
1
Gemfile
@ -28,6 +28,7 @@ end
|
||||
|
||||
group :test do
|
||||
gem "capybara"
|
||||
gem "launchy"
|
||||
gem "rspec-rails"
|
||||
gem "shoulda-matchers"
|
||||
end
|
||||
|
||||
@ -98,6 +98,8 @@ GEM
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jwt (1.5.6)
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
loofah (2.2.2)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
@ -238,6 +240,7 @@ DEPENDENCIES
|
||||
dragonfly
|
||||
http
|
||||
jquery-rails
|
||||
launchy
|
||||
omniauth-github
|
||||
pg
|
||||
pry
|
||||
|
||||
26
spec/features/user_uploads_image_spec.rb
Normal file
26
spec/features/user_uploads_image_spec.rb
Normal file
@ -0,0 +1,26 @@
|
||||
require "rails_helper"
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
|
||||
OmniAuth.config.mock_auth[:twitter] = OmniAuth::AuthHash.new(
|
||||
provider: "github",
|
||||
uid: "1",
|
||||
)
|
||||
|
||||
describe "user uploads image" do
|
||||
it "uploads the image" do
|
||||
visit "/"
|
||||
|
||||
sign_in
|
||||
|
||||
save_and_open_page
|
||||
|
||||
attach_file("Image", "#{Rails.root}/spec/fixtures/spectrum.jpg")
|
||||
end
|
||||
|
||||
def sign_in
|
||||
within(".centre-stage") do
|
||||
click_link("Sign in with GitHub")
|
||||
end
|
||||
end
|
||||
end
|
||||
BIN
spec/fixtures/spectrum.jpg
vendored
Normal file
BIN
spec/fixtures/spectrum.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@ -9,6 +9,8 @@ end
|
||||
require "rspec/rails"
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
|
||||
require "capybara/rspec"
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||
# run as spec files by default. This means that files in spec/support that end
|
||||
@ -32,6 +34,7 @@ rescue ActiveRecord::PendingMigrationError => e
|
||||
puts e.to_s.strip
|
||||
exit 1
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user