Skip to content

Commit

Permalink
Renamed/organized factories, updated citable concern to change Class:…
Browse files Browse the repository at this point in the history
…:Subclass to class_subclass
  • Loading branch information
mbeckman committed Dec 11, 2013
1 parent 644ea39 commit 6712410
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 133 deletions.
@@ -1,5 +1,5 @@
FactoryGirl.define do
factory :bibtex_source, class: Source::Bibtex, traits: [:creator_and_updater] do
factory :source_bibtex, class: Source::Bibtex, traits: [:creator_and_updater] do
factory :valid_bibtex_source do
bibtex_type 'article'
title 'article 1 just title'
Expand Down
@@ -1,6 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
factory :source_verbatim, :class => 'Source::Verbatim' do
factory :source_verbatim, :class => 'Source::Verbatim', traits: [:creator_and_updater] do
end
end
10 changes: 5 additions & 5 deletions spec/models/person_spec.rb
Expand Up @@ -3,7 +3,7 @@
describe Person do

let(:person) { FactoryGirl.build(:person) }
let(:bibtex_source) {
let(:source_bibtex) {
FactoryGirl.create(:valid_bibtex_source)
}
let(:human_source) {
Expand Down Expand Up @@ -126,16 +126,16 @@
specify 'is_author?' do
expect(@vp).to respond_to(:is_author?)
expect(@vp.is_author?).to be_false
bibtex_source.authors << @vp
bibtex_source.save!
source_bibtex.authors << @vp
source_bibtex.save!
@vp.reload
expect(@vp.is_author?).to be_true
end
specify 'is_editor?' do
expect(@vp).to respond_to(:is_editor?)
expect(@vp.is_editor?).to be_false
bibtex_source.editors << @vp
bibtex_source.save!
source_bibtex.editors << @vp
source_bibtex.save!
@vp.reload
expect(@vp.is_editor?).to be_true
end
Expand Down
246 changes: 123 additions & 123 deletions spec/models/source/bibtex_spec.rb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/models/taxon_name_spec.rb
Expand Up @@ -213,7 +213,7 @@
taxon_name.source = h
taxon_name.valid?
expect(taxon_name.errors.include?(:source_id)).to be_true
b = FactoryGirl.build(:bibtex_source)
b = FactoryGirl.build(:source_bibtex)
taxon_name.source = b
taxon_name.valid?
expect(taxon_name.errors.include?(:source_id)).to be_false
Expand Down
3 changes: 2 additions & 1 deletion spec/support/concerns/citable.rb
@@ -1,7 +1,8 @@
shared_examples 'citable' do

# use, create (class_with_citations has to have an ID)
let(:class_with_citations) {FactoryGirl.create("valid_#{described_class.name.underscore}".to_sym)}
let(:class_with_citations) {FactoryGirl.create("valid_#{described_class.name.tableize.singularize.gsub('/', '_')}".to_sym)}
# above modefies n = "ClassName::SubclassName" to "class_name_subclass_name"

context 'associations' do
specify 'has many citations - includes creating a citation' do
Expand Down
2 changes: 1 addition & 1 deletion spec/support/concerns/identifiable.rb
Expand Up @@ -4,7 +4,7 @@

context "reflections / foreign keys" do
specify "has many identifiers" do
expect(identifiable_class).to respond_to(:identifier)
expect(identifiable_class).to respond_to(:identifiers)
end
end

Expand Down

0 comments on commit 6712410

Please sign in to comment.