noosfero | Fix unit tests
Bráulio Bhavamitra
gitlab at gitlab.com
Sun Feb 22 14:46:51 BRT 2015
Bráulio Bhavamitra pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>
Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/f6b51288b1c8902caeb46e736502645979b384b2">f6b51288</a> by Braulio Bhavamitra
Fix unit tests
- - - - -
Changes:
=====================================
app/models/input.rb
=====================================
--- a/app/models/input.rb
+++ b/app/models/input.rb
@@ -1,6 +1,7 @@
class Input < ActiveRecord::Base
- attr_accessible :product, :product_category, :product_category_id, :amount_used, :unit_id, :price_per_unit, :relevant_to_price
+ attr_accessible :product, :product_id, :product_category, :product_category_id,
+ :amount_used, :unit_id, :price_per_unit, :relevant_to_price, :is_from_solidarity_economy
belongs_to :product
belongs_to :product_category
=====================================
app/models/product.rb
=====================================
--- a/app/models/product.rb
+++ b/app/models/product.rb
@@ -10,7 +10,8 @@ class Product < ActiveRecord::Base
:display => %w[full map]
}
- attr_accessible :name, :product_category, :highlighted, :price, :enterprise, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list
+ attr_accessible :name, :product_category, :profile, :profile_id, :enterprise,
+ :highlighted, :price, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list
def self.default_search_display
'full'
=====================================
test/unit/external_feed_test.rb
=====================================
--- a/test/unit/external_feed_test.rb
+++ b/test/unit/external_feed_test.rb
@@ -18,7 +18,8 @@ class ExternalFeedTest < ActiveSupport::TestCase
end
should 'not add same item twice' do
- e = create(:external_feed)
+ blog = create_blog
+ e = create(:external_feed, blog: blog)
assert e.add_item('Article title', 'http://orig.link.invalid', Time.now, 'Content for external post')
assert !e.add_item('Article title', 'http://orig.link.invalid', Time.now, 'Content for external post')
assert_equal 1, e.blog.posts.size
@@ -52,7 +53,8 @@ class ExternalFeedTest < ActiveSupport::TestCase
should 'add items to blog as posts' do
handler = FeedHandler.new
- e = create(:external_feed)
+ blog = create_blog
+ e = create(:external_feed, blog: blog)
handler.process(e)
assert_equal ["Last POST", "Second POST", "First POST"], e.blog.posts.map{|i| i.title}
end
=====================================
test/unit/product_test.rb
=====================================
--- a/test/unit/product_test.rb
+++ b/test/unit/product_test.rb
@@ -492,7 +492,7 @@ class ProductTest < ActiveSupport::TestCase
:amount_used => 10, :price_per_unit => 10, :is_from_solidarity_economy => false)
assert_equal 25, prod.percentage_from_solidarity_economy.first
- prod = fast_create(Product, :name => 'test product1', :product_category_id => @product_category.id, :enterprise_id => @profile.id)
+ prod = fast_create(Product, :name => 'test product1', :product_category_id => @product_category.id, :profile_id => @profile.id)
prod.inputs.create!(:product_id => prod.id, :product_category_id => @product_category.id,
:amount_used => 10, :price_per_unit => 10, :is_from_solidarity_economy => true)
prod.inputs.create!(:product_id => prod.id, :product_category_id => @product_category.id,
@@ -503,7 +503,7 @@ class ProductTest < ActiveSupport::TestCase
:amount_used => 10, :price_per_unit => 10, :is_from_solidarity_economy => false)
assert_equal 75, prod.percentage_from_solidarity_economy.first
- prod = fast_create(Product, :name => 'test product', :product_category_id => @product_category.id, :enterprise_id => @profile.id)
+ prod = fast_create(Product, :name => 'test product', :product_category_id => @product_category.id, :profile_id => @profile.id)
prod.inputs.create!(:product_id => prod.id, :product_category_id => @product_category.id,
:amount_used => 10, :price_per_unit => 10, :is_from_solidarity_economy => true)
assert_equal 100, prod.percentage_from_solidarity_economy.first
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150222/08ddd6eb/attachment.html>
More information about the Noosfero-dev
mailing list