Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: CristinaRO/otwarchive
...
head fork: CristinaRO/otwarchive
  • 16 commits
  • 30 files changed
  • 0 commit comments
  • 6 contributors
Commits on Apr 14, 2012
@mumble mumble Issue 3002, adds alt text display to complement issue 2541 81c54aa
Commits on Apr 15, 2012
@elzj elzj Issue 2169: Series with public works stuck as restricted 1c5436e
@elzj elzj Issue 2943: Allow wranglers to mark tags as unwrangleable 67cdc5c
@CristinaRO Updating cuke to reflect the changes in class structure bc7118f
@elzj elzj Display unwrangleable tags on wrangle pages and don't include then in…
… unfilterable lists
2544aa9
@elzj elzj Merge pull request #581 from CristinaRO/tos-feature
Updating cuke to reflect the changes in class structure
2760113
@elzj elzj Merge pull request #579 from mumble/issue3002
Issue 3002, adds alt text display to complement issue 2541
e5bc8cb
@CristinaRO Merge pull request #580 from elzj/series-restricted
Issue 2169: Series with public works stuck as restricted
3016ce0
@sarken sarken Use byline instead of name bb5c05e
Commits on Apr 16, 2012
@CristinaRO Issue 3011: import from deviantart
Contains a test for importing from the gallery link, should anyone want
to implement that (it needs javascript, since this is how deviant art
does it)
fd28c61
Commits on Apr 17, 2012
@CristinaRO Merge pull request #582 from elzj/issue-2943-unwrangleable-tags
Issue 2943: Unwrangleable tags
59bcba4
Commits on Apr 20, 2012
@elzj elzj Issue 2997: Adding series subscriptions 1aae2e6
@elzj elzj Making sure profile subscriptions work as well 1b351ca
@shalott shalott Merge pull request #587 from elzj/issue-2997-series-subscription
Issue 2997: Adding series subscriptions
5aaa66f
@elzj elzj Merge pull request #586 from CristinaRO/devart-feature
Issue 3011: import from deviantart
2d578a0
@elzj elzj Merge pull request #583 from sarken/issue_2133
Issue 2133 use byline instead of pseud on pseud works index
c6d1d28
Showing with 178 additions and 78 deletions.
  1. +1 −1  app/controllers/chapters_controller.rb
  2. +1 −1  app/controllers/profile_controller.rb
  3. +1 −1  app/controllers/pseuds_controller.rb
  4. +5 −0 app/controllers/series_controller.rb
  5. +1 −1  app/controllers/tags_controller.rb
  6. +1 −1  app/controllers/users_controller.rb
  7. +1 −1  app/controllers/works_controller.rb
  8. +1 −11 app/mailers/user_mailer.rb
  9. +1 −1  app/models/fandom.rb
  10. +1 −1  app/models/serial_work.rb
  11. +5 −2 app/models/series.rb
  12. +8 −7 app/models/story_parser.rb
  13. +17 −3 app/models/subscription.rb
  14. +11 −3 app/models/tag.rb
  15. +1 −2  app/views/collections/_collection_blurb.html.erb
  16. +2 −2 app/views/collections/_header.html.erb
  17. +5 −0 app/views/series/show.html.erb
  18. +13 −0 app/views/subscriptions/_form.html.erb
  19. +4 −0 app/views/subscriptions/index.html.erb
  20. +6 −0 app/views/tags/edit.html.erb
  21. +5 −2 app/views/tags/wrangle.html.erb
  22. +2 −10 app/views/users/_header_navigation.html.erb
  23. +5 −13 app/views/works/_work_header_navigation.html.erb
  24. +1 −1  app/views/works/index.html.erb
  25. +9 −0 db/migrate/20120415134615_add_unwrangleable_to_tags.rb
  26. +2 −2 features/ToS_links.feature
  27. +4 −0 features/support/factories.rb
  28. +4 −2 features/support/vcr.rb
  29. +29 −10 features/work_import_da.feature
  30. +31 −0 spec/models/series_spec.rb
View
2  app/controllers/chapters_controller.rb
@@ -68,7 +68,7 @@ def show
if current_user.respond_to?(:subscriptions)
@subscription = current_user.subscriptions.where(:subscribable_id => @work.id,
:subscribable_type => 'Work').first ||
- current_user.subscriptions.build
+ current_user.subscriptions.build(:subscribable => @work)
end
# TEMPORARY hack-like thing to fix the fact that chaptered works weren't hit-counted or added to history at all
View
2  app/controllers/profile_controller.rb
@@ -13,7 +13,7 @@ def show
if current_user.respond_to?(:subscriptions)
@subscription = current_user.subscriptions.where(:subscribable_id => @user.id,
:subscribable_type => 'User').first ||
- current_user.subscriptions.build
+ current_user.subscriptions.build(:subscribable => @user)
end
end
View
2  app/controllers/pseuds_controller.rb
@@ -69,7 +69,7 @@ def show
if current_user.respond_to?(:subscriptions)
@subscription = current_user.subscriptions.where(:subscribable_id => @user.id,
:subscribable_type => 'User').first ||
- current_user.subscriptions.build
+ current_user.subscriptions.build(:subscribable => @user)
end
end
View
5 app/controllers/series_controller.rb
@@ -50,6 +50,11 @@ def show
@serial_works = @series.serial_works.find(:all, :include => :work, :conditions => ['works.posted = ?', true], :order => :position).select{|sw| sw.work.visible(User.current_user)}
# sets the page title with the data for the series
@page_title = @series.unrevealed? ? ts("Mystery Series") : get_page_title(@series.allfandoms.collect(&:name).join(', '), @series.anonymous? ? ts("Anonymous") : @series.allpseuds.collect(&:byline).join(', '), @series.title)
+ if current_user.respond_to?(:subscriptions)
+ @subscription = current_user.subscriptions.where(:subscribable_id => @series.id,
+ :subscribable_type => 'Series').first ||
+ current_user.subscriptions.build(:subscribable => @series)
+ end
end
# GET /series/new
View
2  app/controllers/tags_controller.rb
@@ -250,7 +250,7 @@ def wrangle
sort = sort + ", name ASC"
end
# this makes sure params[:status] is safe
- if %w(unfilterable canonical noncanonical).include?(params[:status])
+ if %w(unfilterable canonical noncanonical unwrangleable).include?(params[:status])
@tags = @tag.send(params[:show]).order(sort).send(params[:status]).paginate(:page => params[:page], :per_page => ArchiveConfig.ITEMS_PER_PAGE)
elsif params[:status] == "unwrangled"
@tags = @tag.same_work_tags.unwrangled.by_type(params[:show].singularize.camelize).order(sort).paginate(:page => params[:page], :per_page => ArchiveConfig.ITEMS_PER_PAGE)
View
2  app/controllers/users_controller.rb
@@ -100,7 +100,7 @@ def show
if current_user.respond_to?(:subscriptions)
@subscription = current_user.subscriptions.where(:subscribable_id => @user.id,
:subscribable_type => 'User').first ||
- current_user.subscriptions.build
+ current_user.subscriptions.build(:subscribable => @user)
end
end
View
2  app/controllers/works_controller.rb
@@ -209,7 +209,7 @@ def show
if current_user.respond_to?(:subscriptions)
@subscription = current_user.subscriptions.where(:subscribable_id => @work.id,
:subscribable_type => 'Work').first ||
- current_user.subscriptions.build
+ current_user.subscriptions.build(:subscribable => @work)
end
@page_title = @work.unrevealed? ? ts("Mystery Work") :
View
12 app/mailers/user_mailer.rb
@@ -58,19 +58,9 @@ def subscription_notification(user_id, subscription_id, creation_id, creation_cl
user = User.find(user_id)
@subscription = Subscription.find(subscription_id)
@creation = creation_class_name.constantize.find(creation_id)
- if @subscription.subscribable_type == 'User'
- subject_text = "#{@subscription.name} has posted "
- if creation_class_name == 'Chapter'
- subject_text << "Chapter #{@creation.position} of \"#{@creation.work.title}\""
- elsif creation_class_name == 'Work'
- subject_text << "\"#{@creation.title}\""
- end
- else
- subject_text = "Subscription Notice for #{@subscription.name}"
- end
mail(
:to => user.email,
- :subject => "[#{ArchiveConfig.APP_NAME}] #{subject_text}"
+ :subject => "[#{ArchiveConfig.APP_NAME}] #{@subscription.subject_text(@creation)}"
)
end
View
2  app/models/fandom.rb
@@ -16,7 +16,7 @@ class Fandom < Tag
def self.unwrangled
joins(:common_taggings).
- where("common_taggings.filterable_id = ? AND common_taggings.filterable_type = 'Tag'", Media.uncategorized.try(:id))
+ where("unwrangleable = 0 AND common_taggings.filterable_id = ? AND common_taggings.filterable_type = 'Tag'", Media.uncategorized.try(:id))
end
# An association callback to add the default media if all others have been removed
View
2  app/models/serial_work.rb
@@ -4,7 +4,7 @@ class SerialWork < ActiveRecord::Base
validates_uniqueness_of :work_id, :scope => [:series_id]
acts_as_list :scope => :series
- before_create :adjust_series_visibility
+ after_create :adjust_series_visibility
after_destroy :adjust_series_visibility
after_destroy :delete_empty_series
View
7 app/models/series.rb
@@ -31,6 +31,8 @@ class Series < ActiveRecord::Base
:allow_blank => true,
:maximum => ArchiveConfig.NOTES_MAX,
:too_long => t('notes_too_long', :default => "must be less than %{max} letters long.", :max => ArchiveConfig.NOTES_MAX)
+
+ after_save :adjust_restricted
attr_accessor :authors
attr_accessor :authors_to_remove
@@ -104,8 +106,9 @@ def unrevealed?
# if the series includes an unrestricted work, restricted should be false
# if the series includes no unrestricted works, restricted should be true
def adjust_restricted
- unless self.restricted == !self.works.collect(&:restricted).include?(false)
- self.toggle!(:restricted)
+ unless self.restricted? == !(self.works.where(:restricted => false).count > 0)
+ self.restricted = !(self.works.where(:restricted => false).count > 0)
+ self.save(:validate => false)
end
end
View
15 app/models/story_parser.rb
@@ -618,7 +618,7 @@ def parse_story_from_deviantart(story)
notes = ""
body = @doc.css("body")
- title = @doc.css("title").inner_html.gsub /on DeviantART$/, ""
+ title = @doc.css("title").inner_html.gsub /\s*on deviantart$/i, ""
# Find the image (original size) if it's art
image_full = body.css("img#gmi-ResViewSizer_fullimg")
@@ -626,16 +626,17 @@ def parse_story_from_deviantart(story)
storytext = "<center><img src=\"#{image_full[0]["src"]}\"></center>"
end
- # Find the fic text if it's fic
- text_table = body.css("table.f td.f div.text")[0]
+ # Find the fic text if it's fic (needs the id for disambiguation, the "deviantART loves you" bit in the footer has the same class path)
+ text_table = body.css("#gmi-ResViewContainer table.f td.f div.text")[0]
unless text_table.nil?
- # Try to remove the title:
- unless text_table.css("h1")[0].nil? && text_table.css("h1")[0].match(title)
+ # Try to remove some metadata (title and author) from the work's text, if possible
+ # Try to remove the title: if it exists, and if it's the same as the browser title
+ if text_table.css("h1")[0].present? && title && title.match(text_table.css("h1")[0].text)
text_table.css("h1")[0].remove
end
- # Try to remove the author:
- unless text_table.css("small")[0].nil? && text_table.css("small")[0].match(/by ~.*?<a class="u" href=/m)
+ # Try to remove the author: if it exists, and if it follows a certain pattern
+ if text_table.css("small")[0].present? && text_table.css("small")[0].inner_html.match(/by ~.*?<a class="u" href=/m)
text_table.css("small")[0].remove
end
storytext = text_table.inner_html
View
20 app/models/subscription.rb
@@ -2,15 +2,17 @@ class Subscription < ActiveRecord::Base
belongs_to :user
belongs_to :subscribable, :polymorphic => true
- validates_presence_of :user
+ validates_presence_of :user, :subscribable_id, :subscribable_type
# Get the subscriptions associated with this work
# currently: users subscribed to work, users subscribed to creator of work
scope :for_work, lambda {|work|
where(["(subscribable_id = ? AND subscribable_type = 'Work')
- OR (subscribable_id IN (?) AND subscribable_type = 'User')",
+ OR (subscribable_id IN (?) AND subscribable_type = 'User')
+ OR (subscribable_id IN (?) AND subscribable_type = 'Series')",
work.id,
- work.pseuds.value_of(:user_id)]).
+ work.pseuds.value_of(:user_id),
+ work.series.value_of(:id)]).
group(:user_id)
}
@@ -25,4 +27,16 @@ def name
end
end
+ def subject_text(creation)
+ authors = creation.pseuds.map{ |p| p.byline }.to_sentence
+ if creation.is_a?(Chapter)
+ "#{creation.work.title} by #{authors} has been updated"
+ elsif subscribable_type == 'User'
+ "#{self.name} has posted #{creation.title}"
+ elsif subscribable_type == 'Series'
+ verb = creation.pseuds.length > 1 ? 'have' : 'has'
+ "#{authors} #{verb} updated the '#{self.name}' series"
+ end
+ end
+
end
View
14 app/models/tag.rb
@@ -85,6 +85,13 @@ def commentable_owners
validates_format_of :name,
:with => /\A[^,*<>^{}=`\\%]+\z/,
:message => 'of a tag can not include the following restricted characters: , ^ * < > { } = ` \\ %'
+
+ validate :unwrangleable_status
+ def unwrangleable_status
+ if unwrangleable? && (canonical? || merger_id.present?)
+ self.errors.add(:unwrangleable, "can't be set on a canonical or synonymized tag.")
+ end
+ end
before_validation :check_synonym
def check_synonym
@@ -130,11 +137,12 @@ def update_wrangler(tag)
scope :canonical, where(:canonical => true)
scope :noncanonical, where(:canonical => false)
scope :nonsynonymous, noncanonical.where(:merger_id => nil)
- scope :unfilterable, nonsynonymous
+ scope :unfilterable, nonsynonymous.where(:unwrangleable => false)
+ scope :unwrangleable, where(:unwrangleable => true)
# we need to manually specify a LEFT JOIN instead of just joins(:common_taggings or :meta_taggings) here because
# what we actually need are the empty rows in the results
- scope :unwrangled, joins("LEFT JOIN `common_taggings` ON common_taggings.common_tag_id = tags.id").where("common_taggings.id IS NULL")
+ scope :unwrangled, joins("LEFT JOIN `common_taggings` ON common_taggings.common_tag_id = tags.id").where("unwrangleable = 0 AND common_taggings.id IS NULL")
scope :in_use, where("canonical = 1 OR taggings_count > 0")
scope :first_class, joins("LEFT JOIN `meta_taggings` ON meta_taggings.sub_tag_id = tags.id").where("meta_taggings.id IS NULL")
@@ -470,7 +478,7 @@ def child_types
# Instance methods that are common to all subclasses (may be overridden in the subclass)
def unwrangled?
- !self.canonical && !self.merger_id && self.mergers.empty?
+ !(self.canonical? || self.unwrangleable? || self.merger_id.present? || self.mergers.any?)
end
# sort tags by name
View
3  app/views/collections/_collection_blurb.html.erb
@@ -10,8 +10,7 @@
</h4>
<!--collections header iconised header image-->
<div class="icon">
-<%# don't alt this icon it's currently only decorative%>
- <%= image_tag(collection.icon.url(:standard), :size => "100x100", :alt => "", :class => "icon") %>
+ <%= image_tag(collection.icon.url(:standard), :size => "100x100", :alt => collection.icon_alt_text, :class => "icon") %>
</div>
<p class="datetime" title="updated"><%= set_format_for_date(collection.updated_at) %></p>
<% if collection.all_moderators.length > 0%>
View
4 app/views/collections/_header.html.erb
@@ -3,8 +3,8 @@
<div class="primary header module">
<h2 class="heading"><%= link_to_unless_current(@collection.title, @collection) %></h2>
<div class="icon">
- <% #back end if pos can we make this only print an img if there's one uploaded %>
- <%= image_tag(@collection.icon.url(:standard), :size => "100x100", :alt => "") %></div>
+ <%= image_tag(@collection.icon.url(:standard), :size => "100x100", :alt => collection.icon_alt_text) %>
+ </div>
<!--/descriptions-->
<!--subnav-->
View
5 app/views/series/show.html.erb
@@ -10,6 +10,11 @@
<!--subnav-->
<% if logged_in? %>
<ul class="navigation actions" role="navigation">
+ <% if @subscription %>
+ <li>
+ <%= render :partial => 'subscriptions/form', :locals => { :subscription => @subscription } %>
+ </li>
+ <% end %>
<% @bookmark ||= bookmark_if_exists(@series) %>
<li><%= link_to (@bookmark ? ts("Edit Series Bookmark") : ts("Bookmark Series")), "#bookmark-form", :class => "bookmark_form_placement_open" %></li>
<% if is_author_of?(@series) %>
View
13 app/views/subscriptions/_form.html.erb
@@ -0,0 +1,13 @@
+<% if current_user && subscription %>
+ <% if subscription.new_record? %>
+ <%= form_for [current_user, subscription] do |f| %>
+ <%= f.hidden_field :subscribable_id %>
+ <%= f.hidden_field :subscribable_type %>
+ <%= f.submit ts("Subscribe") %>
+ <% end %>
+ <% else %>
+ <%= form_for [current_user, subscription], :html => {:method => :delete} do |f| %>
+ <%= f.submit ts("Unsubscribe") %>
+ <% end %>
+ <% end %>
+<% end %>
View
4 app/views/subscriptions/index.html.erb
@@ -10,6 +10,10 @@
<% @subscriptions.each do |subscription| %>
<dt>
<%= link_to(subscription.name, subscription.subscribable) %>
+ (<%= subscription.subscribable_type %>)
+ <% if %w(Work Series).include?(subscription.subscribable_type) %>
+ <%= ts("by %{names}", :names => byline(subscription.subscribable)).html_safe %>
+ <% end %>
</dt>
<dd>
<%= form_for [current_user, subscription], :html => {:method => :delete} do |f| %>
View
6 app/views/tags/edit.html.erb
@@ -43,6 +43,12 @@
<% end %>
</dd>
+ <dt><%= f.label :unwrangleable %></dt>
+ <dd>
+ <%= f.check_box :unwrangleable %>&nbsp;
+ <p><%= "This tag will never be merged or made canonical and should not be included on wrangling pages." %></p>
+ </dd>
+
<% if @tag.is_a?(Rating)%>
<dt><%= f.label :adult, 'Adult' %></dt>
<dd><%= f.check_box("adult", :disabled => !logged_in_as_admin? )%>&nbsp;<%= 'This tag indicates adult content.'%></dd>
View
7 app/views/tags/wrangle.html.erb
@@ -50,6 +50,7 @@
<li><%= link_to 'non-canonical', url_for(:show => params[:show], :status => 'noncanonical') %></li>
<li><%= link_to 'unfilterable', url_for(:show => params[:show], :status => 'unfilterable'), :title => "non-canonical tags without synonyms" %></li>
<li><%= link_to 'unwrangled', url_for(:show => params[:show], :status => 'unwrangled'), :title => "tags which were used on the same works but haven't been wrangled yet" %></li>
+ <li><%= link_to 'unwrangleable', url_for(:show => params[:show], :status => 'unwrangleable'), :title => "tags marked unwrangleable" %>
</ul>
<% end %>
@@ -104,9 +105,11 @@
<% end %>
<td title="canonical?">
<% if tag.canonical? %>
- Yes
+ Yes
+ <% elsif tag.unwrangleable? %>
+ Unwrangleable
<% else %>
- <%= check_box_tag "canonicals[]", tag.id, tag.canonical?, :id => "canonicals_#{tag.id}" %>
+ <%= check_box_tag "canonicals[]", tag.id, tag.canonical?, :id => "canonicals_#{tag.id}" %>
<% end %>
</td>
<td title="metatag or synonym">
View
12 app/views/users/_header_navigation.html.erb
@@ -10,18 +10,10 @@
<% unless @user == current_user %>
<li><%= link_to_help "coming-soon", ts("Bookmark") %></li>
<% end %>
- <% if @subscription && @subscription.new_record? %>
+ <% if current_user && @subscription %>
<li>
- <%= form_for [current_user, @subscription] do |f| %>
- <%= f.hidden_field :subscribable_id, :value => @user.id %>
- <%= f.hidden_field :subscribable_type, :value => @user.class.to_s %>
- <%= f.submit ts("Subscribe") %>
- <% end %>
+ <%= render :partial => 'subscriptions/form', :locals => { :subscription => @subscription } %>
</li>
- <% elsif @subscription %>
- <%= form_for [current_user, @subscription], :html => {:method => :delete} do |f| %>
- <li><%= f.submit ts("Unsubscribe") %></li>
- <% end %>
<% end %>
<% if @user == current_user %>
<li><%= span_if_current ts("Invitations"), user_invitations_path(@user) %></li>
View
18 app/views/works/_work_header_navigation.html.erb
@@ -91,19 +91,11 @@
</div>
</li>
- <li class="subscribe">
- <% if @subscription && @subscription.new_record? %>
- <%= form_for [current_user, @subscription] do |f| %>
- <%= f.hidden_field :subscribable_id, :value => @work.id %>
- <%= f.hidden_field :subscribable_type, :value => @work.class.to_s %>
- <%= f.submit "Subscribe" %>
- <% end %>
- <% elsif @subscription %>
- <%= form_for [current_user, @subscription], :html => {:method => :delete} do |f| %>
- <li><%= f.submit ts("Unsubscribe") %></li>
- <% end %>
- <% end %>
- </li>
+ <% if current_user && @subscription %>
+ <li class="subscribe">
+ <%= render :partial => 'subscriptions/form', :locals => { :subscription => @subscription } %>
+ </li>
+ <% end %>
<li class="download" aria-haspopup="true">
<a title="Download" class="downloads_open open"><%= ts("Download") %> &#8595;</a>
View
2  app/views/works/index.html.erb
@@ -4,7 +4,7 @@
<% if @collection %>
<%= ts("in %{collection_title}", :collection_title => link_to(@collection.title, @collection)).html_safe %>
<% elsif @user %>
- <%= @author ? ts("by %{author_name}", :author_name => @author.name) : ts("by %{user_name}", :user_name => @user.login) %>
+ <%= @author ? ts("by %{author_byline}", :author_byline => @author.byline) : ts("by %{user_name}", :user_name => @user.login) %>
<% elsif @tag %>
<%= ts("in %{tag_name}", :tag_name => @tag.name) %>
<% end %>
View
9 db/migrate/20120415134615_add_unwrangleable_to_tags.rb
@@ -0,0 +1,9 @@
+class AddUnwrangleableToTags < ActiveRecord::Migration
+ def self.up
+ add_column :tags, :unwrangleable, :boolean, :default => false, :null => false
+ end
+
+ def self.down
+ remove_column :tags, :unwrangleable
+ end
+end
View
4 features/ToS_links.feature
@@ -9,7 +9,7 @@ Feature: Links in ToS
# check you're on the Terms of service page
- Then I should see "Terms of Service" within ".home-tos h2"
+ Then I should see "Terms of Service" within ".tos h2"
And I should see "While the Archive is in beta, it's important for users to be aware of what that means"
# all commented out lines concerning URLs lack a viable step definition
@@ -54,7 +54,7 @@ Feature: Links in ToS
# check following an internal link from the table of contents
- When I follow "Privacy Policy" within ".home-tos .toc"
+ When I follow "Privacy Policy" within ".tos .toc"
Then I should see "III. Archive Privacy Policy"
# TODO: figure out why this isn't working
# And the page URL should be "http://www.example.com/tos#privacy"
View
4 features/support/factories.rb
@@ -69,6 +69,10 @@
end
end
+Factory.define :series do |f|
+ f.sequence(:title) { |n| "Awesome Series #{n}" }
+end
+
# Factory.define :collection_participant do |f|
# f.association :pseud
# f.association :collection
View
6 features/support/vcr.rb
@@ -26,8 +26,10 @@
t.tags '@work_import_nul_character'
t.tags '@work_import_errors', :record => :all # need to run this every time bc the url is a bogus one (on purpose, for testing) so it's never properly "recorded"
- t.tags '@import_da'
- t.tags '@import_da_fic'
+ # need to run this every time for the devart features, because the recorded responses run into an encoding error I don't have time to investigate
+ t.tags '@import_da_title_link', :record => :all
+ # t.tags '@import_da_gallery_link', :record => :all # TODO: uncomment if/when implementing this feature
+ t.tags '@import_da_fic', :record => :all
t.tags '@import_dw'
t.tags '@import_dw_tables'
View
39 features/work_import_da.feature
@@ -3,13 +3,10 @@ Feature: Import Works from deviantart
In order to have an archive full of works
As an author
I want to create new works by importing them from deviantart
- @import_da
- Scenario: Creating a new art work from an deviantart story with automatic metadata
+ @import_da_title_link
+ Scenario: Creating a new art work from a deviantart title link with automatic metadata
Given basic tags
- And the following activated user exists
- | login | password |
- | cosomeone | something |
- And I am logged in as "cosomeone" with password "something"
+ And I am logged in as "cosomeone"
When I go to the import page
And I fill in "urls" with "http://bingeling.deviantart.com/art/Flooded-45971613"
When I press "Import"
@@ -31,13 +28,35 @@ Feature: Import Works from deviantart
When I am on cosomeone's user page
#'
Then I should see "Flooded"
+ # @import_da_gallery_link
+ # Scenario: TODO: Creating a new art work from a deviantart gallery link with automatic metadata
+ # Given basic tags
+ # And I am logged in as "cosomeone"
+ # When I go to the import page
+ # And I fill in "urls" with "http://bingeling.deviantart.com/gallery/#/drdbx9"
+ # When I press "Import"
+ # Then I should see "Preview"
+ # And I should find "Flooded_by_bingeling.jpg" within "img[src]"
+ # And I should see "Digital Art" within "dd.freeform"
+ # And I should see "People" within "dd.freeform"
+ # And I should see "Vector" within "dd.freeform"
+ # And I should see "Published:2007-01-04"
+ # And I should see "Flooded" within "h2.title"
+ # And I should see "done with Photoshop 7" within "div.notes"
+ # And I should see "but they were definitely helpful" within "div.notes"
+ # And I should not see "deviant"
+ # And I should not see "bingeling"
+ # And I should not see "Visit the Artist"
+ # And I should not see "Download Image"
+ # When I press "Post"
+ # Then I should see "Work was successfully posted."
+ # When I am on cosomeone's user page
+ # #'
+ # Then I should see "Flooded"
@import_da_fic
Scenario: Creating a new fic from an deviantart
Given basic tags
- And the following activated user exists
- | login | password |
- | cosomeone | something |
- And I am logged in as "cosomeone" with password "something"
+ And I am logged in as "cosomeone"
When I go to the import page
And I fill in "urls" with "http://cesy12.deviantart.com/art/AO3-testing-text-196158032"
When I press "Import"
View
31 spec/models/series_spec.rb
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+require 'spec_helper'
+
+describe Series do
+
+ let(:unrestricted_work) { Factory(:work, :restricted => false) }
+ let(:restricted_work) { Factory(:work, :restricted => true) }
+
+ before(:each) do
+ @series = Factory.create(:series)
+ end
+
+ it "should be unrestricted when it has unrestricted works" do
+ @series.works = [unrestricted_work]
+ @series.reload
+ @series.restricted.should_not be_true
+ end
+
+ it "should be restricted when it has no unrestricted works" do
+ @series.works = [restricted_work]
+ @series.reload
+ @series.restricted.should be_true
+ end
+
+ it "should be unrestricted when it has both restricted and unrestricted works" do
+ @series.works = [restricted_work, unrestricted_work]
+ @series.reload
+ @series.restricted.should_not be_true
+ end
+
+end

No commit comments for this range

Something went wrong with that request. Please try again.