Skip to content

Commit

Permalink
rename Factory by FactoryGirl (fix some deprecation warning)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbounmy committed May 17, 2012
1 parent 57a2236 commit 22e98a1
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion spec/mailers/order_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/models/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/models/taxon_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/models/taxonomy_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/de/admin/products_spec.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/option_types_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions spec/requests/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions spec/requests/taxons_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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'
Expand Down

0 comments on commit 22e98a1

Please sign in to comment.