forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hotsh#696 from tlatsas/export-status
Adds export action for the authorized user. This will add a route and link on the current user's profile to export all statuses as json. This may be a long-running process, however, and may be an issue in the future. Closes hotsh#653
- Loading branch information
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'require_relative' if RUBY_VERSION[0,3] == '1.8' | ||
require_relative 'acceptance_helper' | ||
|
||
describe "export updates" do | ||
include AcceptanceHelper | ||
|
||
describe "logged in" do | ||
before do | ||
log_in_as_some_user | ||
update = Fabricate(:update, :author => @u.author) | ||
end | ||
|
||
it "has a link to export all updates" do | ||
visit "/users/#{@u.username}" | ||
assert has_link? "Export all updates" | ||
end | ||
|
||
it "exports all updates in json format" do | ||
visit "/users/#{@u.username}" | ||
click_link "Export all updates" | ||
assert_equal "application/json", page.response_headers['Content-Type'] | ||
assert_match /#{@u.username}-updates.json/, page.response_headers['Content-Disposition'] | ||
end | ||
|
||
end | ||
|
||
describe "unauthorized" do | ||
before { visit "/export" } | ||
it "should redirect to root page" do | ||
assert page.has_selector? 'div#signup' | ||
end | ||
end | ||
|
||
end |