upload screenshot anonymously, login in, get screenshots assigned
This commit is contained in:
parent
820ff2a30b
commit
2746b22c18
4 changed files with 70 additions and 32 deletions
|
|
@ -44,4 +44,31 @@ class BrowserBrowseTest < ActionDispatch::IntegrationTest
|
|||
sign_out users(:debian)
|
||||
end
|
||||
|
||||
test "upload screenshot anonymously, login in, get screenshots assigned" do
|
||||
visit upload_path(name: 'firefox')
|
||||
attach_file 'file[]', Rails.root.join('test/fixtures/files/large1.png')
|
||||
click_on 'Start upload'
|
||||
|
||||
# Screenshot has not yet a user assigned
|
||||
newest_screenshot = Package.find_by_name(:firefox).screenshots.order(id: :desc).first
|
||||
assert_nil newest_screenshot.user
|
||||
|
||||
# Login (sign_in is just a stub and would not call the callbacks!)
|
||||
visit root_path
|
||||
click_link 'Login'
|
||||
within 'form' do
|
||||
fill_in 'email address', with: users(:normal).email
|
||||
fill_in 'password', with: 'normalsecret'
|
||||
click_button 'Log in'
|
||||
end
|
||||
|
||||
# Check if screenshot was assigned to the user
|
||||
newest_screenshot = Package.find_by_name(:firefox).screenshots.order(id: :desc).first
|
||||
assert_equal newest_screenshot.user, users(:normal)
|
||||
|
||||
# Clean up
|
||||
newest_screenshot.destroy
|
||||
sign_out users(:debian)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue