Browse files

rename Factory by FactoryGirl (fix some deprecation warning)

  • Loading branch information...
1 parent 57a2236 commit 22e98a113dd39e4f4ae42de2d4ba514455e33c4b @sbounmy sbounmy committed May 17, 2012
View
2 spec/mailers/order_mailer_spec.rb
@@ -2,7 +2,7 @@
module Spree
describe OrderMailer do
- let(:order) { Factory(:order, :locale => :fr) }
+ let(:order) { FactoryGirl.create(:order, :locale => :fr) }
let(:mail) { ActionMailer::Base.deliveries.last }
it "should use i18n email template" do
View
4 spec/models/order_spec.rb
@@ -5,7 +5,7 @@ module Spree
describe "#finalize!" do
it "sets order locale" do
I18n.locale = :fr
- order = Factory(:order)
+ order = FactoryGirl.create(:order)
order.finalize!
order.locale.should == :fr
I18n.locale = nil
@@ -14,7 +14,7 @@ module Spree
describe "#locale" do
it "should be stored as str" do
- order = Factory(:order, :locale => :fr)
+ order = FactoryGirl.create(:order, :locale => :fr)
Order.find_by_locale("fr").should == order
end
end
View
4 spec/models/taxon_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
describe Spree::Taxon do
- let(:taxon) { Factory(:taxon, :name => "Ruby on Rails") }
- let(:child) { Factory(:taxon, :name => "Sinatra", :parent => taxon) }
+ let(:taxon) { FactoryGirl.create(:taxon, :name => "Ruby on Rails") }
+ let(:child) { FactoryGirl.create(:taxon, :name => "Sinatra", :parent => taxon) }
describe "#set_permalink" do
it "should return default name if fallback is true and no parents" do
View
2 spec/models/taxonomy_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Spree::Taxonomy do
- let(:taxonomy) { Factory(:taxonomy, :name => "Man") }
+ let(:taxonomy) { FactoryGirl.create(:taxonomy, :name => "Man") }
let(:root) { taxonomy.root }
it "root taxon should set translated name" do
View
4 spec/requests/de/admin/products_spec.rb
@@ -1,10 +1,10 @@
require 'spec_helper'
describe "admin products" do
before do
- sign_in_as!(Factory(:admin_user))
+ sign_in_as!(FactoryGirl.create(:admin_user))
end
- let!(:product) { Factory(:product) }
+ let!(:product) { FactoryGirl.create(:product) }
it "displays price in correct format" do
visit spree.edit_admin_product_path(product)
View
2 spec/requests/option_types_spec.rb
@@ -2,7 +2,7 @@
feature "OptionType multi lingual", :js => true do
background do
- sign_in_as! Factory(:admin_user)
+ sign_in_as! FactoryGirl.create(:admin_user)
visit spree.admin_option_types_path
end
View
4 spec/requests/products_spec.rb
@@ -2,8 +2,8 @@
feature "Products multi lingual", :js => true do
background do
- @product = Factory(:product, :name => "ror mug", :price => 30)
- sign_in_as! Factory(:admin_user)
+ @product = FactoryGirl.create(:product, :name => "ror mug", :price => 30)
+ sign_in_as! FactoryGirl.create(:admin_user)
end
scenario "admin should be able to edit product page i18n" do
View
8 spec/requests/taxons_spec.rb
@@ -3,7 +3,7 @@
feature "Products multi lingual", :js => true do
background do
I18n.stub(:available_locales).and_return [:en, :fr, :es]
- sign_in_as! Factory(:admin_user)
+ sign_in_as! FactoryGirl.create(:admin_user)
end
scenario "admin should be able to create taxonomy" do
@@ -75,7 +75,7 @@
scenario "admin should be able to edit child taxons" do
@parent = Spree::Taxon.last
- @child = Factory(:taxon, :name => "child", :parent => @parent, :taxonomy => @taxonomy)
+ @child = FactoryGirl.create(:taxon, :name => "child", :parent => @parent, :taxonomy => @taxonomy)
visit spree.edit_admin_taxonomy_taxon_path(@taxonomy, @child)
# verify if the form has correct values
@@ -99,7 +99,7 @@
scenario "admin should be able to edit parent taxon permalink" do
@parent = Spree::Taxon.last
- @child = Factory(:taxon, :name => "Sinatra En", :name_fr => "Sinatra Fr", :name_es => "Sinatra Es",
+ @child = FactoryGirl.create(:taxon, :name => "Sinatra En", :name_fr => "Sinatra Fr", :name_es => "Sinatra Es",
:permalink_fr => "sinatra-fr", :permalink => "sinatra-en", :permalink_es => "sinatra-es", :parent => @parent, :taxonomy => @taxonomy)
visit spree.edit_admin_taxonomy_taxon_path(@taxonomy, @parent)
@@ -125,7 +125,7 @@
scenario "by explicitly setting their locale, user should be redirected to the viewed link with the setted locale", :js => false do
pending "TODO ! cf locale_controller_decorator#set"
- Factory(:taxon, :name => "Ruby on Rails", :permalink_fr => "ror-fr", :permalink_es => "ror-es", :permalink => "ror", :permalink_en => "ror")
+ FactoryGirl.create(:taxon, :name => "Ruby on Rails", :permalink_fr => "ror-fr", :permalink_es => "ror-es", :permalink => "ror", :permalink_en => "ror")
get "/en/t/ror"
get "/fr/locale/set", {}, {'HTTP_REFERER' => 'http://example.com/en/t/ror', 'HTTP_HOST' => 'example.com'} #manually set 'HTTP_REFERER' AND 'HTTP_HOST'

0 comments on commit 22e98a1

Please sign in to comment.