Skip to content

Commit

Permalink
Merge branch 'master' into feature/consistent-dummy-app
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt authored Oct 30, 2017
2 parents 3e6122f + 4bec652 commit 8665525
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 54 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.2 [Unreleased]

* Renamed FactoryGirl to FactoryBot. [#3324](https://github.com/refinery/refinerycms/pull/3324). [Philip Arndt](https://github.com/parndt)

## 4.0.1 [24 October 2017]

* Always expect to have css and js files precompiled. Remove skip_pipeline option for visual_editor_stylesheets and custom_stylesheets. [#3318](https://github.com/refinery/refinerycms/pull/3318). [Brice Sanchez](https://github.com/bricesanchez)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ describe Refinery do
<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>
describe "<%= plural_name %> list" do
before do
FactoryGirl.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitleOne")
FactoryGirl.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitleTwo")
FactoryBot.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitleOne")
FactoryBot.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitleTwo")
end

it "shows two items" do
Expand Down Expand Up @@ -45,7 +45,7 @@ describe Refinery do
end

context "duplicate" do
before { FactoryGirl.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitle") }
before { FactoryBot.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitle") }

it "should fail" do
visit refinery.<%= namespacing.underscore %>_admin_<%= plural_name %>_path
Expand Down Expand Up @@ -161,7 +161,7 @@ describe Refinery do
end

describe "edit" do
before { FactoryGirl.create(:<%= singular_name %>, :<%= title.name %> => "A <%= title.name %>") }
before { FactoryBot.create(:<%= singular_name %>, :<%= title.name %> => "A <%= title.name %>") }

it "should succeed" do
visit refinery.<%= namespacing.underscore %>_admin_<%= plural_name %>_path
Expand All @@ -179,7 +179,7 @@ describe Refinery do
end

describe "destroy" do
before { FactoryGirl.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitleOne") }
before { FactoryBot.create(:<%= singular_name %>, :<%= title.name %> => "UniqueTitleOne") }

it "should succeed" do
visit refinery.<%= namespacing.underscore %>_admin_<%= plural_name %>_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Refinery
describe <%= class_name %> do
describe "validations", type: :model do
subject do
FactoryGirl.create(:<%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? -%>,
FactoryBot.create(:<%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? -%>,
:<%= title.name %> => "Refinery CMS"<% end %>)
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>
FactoryGirl.define do
FactoryBot.define do
factory :<%= singular_name %>, :class => Refinery::<%= namespacing %>::<%= class_name %> do
sequence(:<%= title.name %>) { |n| "refinery#{n}" }
end
Expand Down
4 changes: 2 additions & 2 deletions core/spec/features/refinery/admin/xhr_paging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module Refinery
# Refinery::Admin::ImagesController specifies :order => 'created_at DESC' in crudify
let(:first_image) { Image.order('created_at DESC').first }
let(:last_image) { Image.order('created_at DESC').last }
let!(:image_1) { FactoryGirl.create :image }
let!(:image_2) { FactoryGirl.create :image }
let!(:image_1) { FactoryBot.create :image }
let!(:image_2) { FactoryBot.create :image }

before do
allow(Image).to receive(:per_page).and_return(1)
Expand Down
2 changes: 1 addition & 1 deletion core/spec/features/refinery/application_layout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Refinery
refinery_login

let(:home_page) do
FactoryGirl.create :page, :title => 'Home', :link_url => '/'
FactoryBot.create :page, :title => 'Home', :link_url => '/'
end

describe 'body' do
Expand Down
2 changes: 1 addition & 1 deletion core/spec/features/refinery/site_bar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module Refinery

context "when in frontend" do
# make a page in order to avoid 404
let!(:root_page) { FactoryGirl.create(:page, :link_url => "/") }
let!(:root_page) { FactoryBot.create(:page, :link_url => "/") }
before { visit refinery.root_path }

it "has a 'switch to your website editor' button" do
Expand Down
4 changes: 2 additions & 2 deletions core/spec/helpers/refinery/translation_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Refinery
end

describe "#translated_field" do
let(:page) { FactoryGirl.build(:page) }
let(:page) { FactoryBot.build(:page) }

before do
Globalize.with_locale(:en) do
Expand Down Expand Up @@ -40,4 +40,4 @@ module Refinery
end

end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Refinery
describe TranslatedFieldPresenter do
let(:page) { FactoryGirl.build(:page) }
let(:page) { FactoryBot.build(:page) }

before do
Globalize.with_locale(:en) do
Expand Down
2 changes: 1 addition & 1 deletion images/spec/factories/image.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :image, :class => ::Refinery::Image do
image Refinery.roots('refinery/images').join("spec/fixtures/beach.jpeg")
end
Expand Down
14 changes: 7 additions & 7 deletions images/spec/models/refinery/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
module Refinery
describe Image, :type => :model do

let(:image) { FactoryGirl.build(:image) }
let(:created_image) { FactoryGirl.create(:image) }
let(:titled_image) { FactoryGirl.create(:image, image_title: 'Image Title')}
let(:image_with_alt_text) { FactoryGirl.create(:image, image_alt: 'Alt Text')}
let(:image_with_sha) {FactoryGirl.create(:image)}
let(:image_without_sha) {FactoryGirl.create(:image)}
let(:image) { FactoryBot.build(:image) }
let(:created_image) { FactoryBot.create(:image) }
let(:titled_image) { FactoryBot.create(:image, image_title: 'Image Title')}
let(:image_with_alt_text) { FactoryBot.create(:image, image_alt: 'Alt Text')}
let(:image_with_sha) {FactoryBot.create(:image)}
let(:image_without_sha) {FactoryBot.create(:image)}

describe "validations" do
describe "valid #image" do
Expand Down Expand Up @@ -202,7 +202,7 @@ module Refinery
end

describe '#thumbnail_dimensions returns correctly with' do
let(:created_alternate_image) { FactoryGirl.create(:alternate_image) }
let(:created_alternate_image) { FactoryBot.create(:alternate_image) }

it 'nil' do
expect(created_alternate_image.thumbnail_dimensions(nil)).to eq({ :width => 376, :height => 184 })
Expand Down
6 changes: 3 additions & 3 deletions images/spec/support/shared_contexts/many_images.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shared_context 'many images' do
let!(:image) { FactoryGirl.create(:image) }
let!(:alt_image) { FactoryGirl.create(:alternate_image) }
let!(:another_image) { FactoryGirl.create(:another_image) }
let!(:image) { FactoryBot.create(:image) }
let!(:alt_image) { FactoryBot.create(:alternate_image) }
let!(:another_image) { FactoryBot.create(:another_image) }
end
2 changes: 1 addition & 1 deletion images/spec/support/shared_contexts/no_images.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
shared_context "no existing images" do
let(:image) { FactoryGirl.create(:image) }
let(:image) { FactoryBot.create(:image) }
end
2 changes: 1 addition & 1 deletion images/spec/support/shared_contexts/one_image.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
shared_context "one image" do
let!(:image) { FactoryGirl.create(:image) }
let!(:image) { FactoryBot.create(:image) }
end
4 changes: 2 additions & 2 deletions pages/spec/controllers/refinery/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module Refinery
describe PagesController, :type => :controller do
before do
FactoryGirl.create(:page, :link_url => "/")
FactoryGirl.create(:page, :title => "test")
FactoryBot.create(:page, :link_url => "/")
FactoryBot.create(:page, :title => "test")
end

describe "#home" do
Expand Down
2 changes: 1 addition & 1 deletion pages/spec/factories/page_parts.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :page_part, class: Refinery::PagePart do
title 'Body'
slug 'side_body'
Expand Down
4 changes: 2 additions & 2 deletions pages/spec/factories/pages.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FactoryGirl.define do
FactoryBot.define do
factory :page, class: Refinery::Page do
sequence(:title, "a") { |n| "Test title #{n}" }

factory :page_with_page_part do
after(:create) do |page|
page.parts << FactoryGirl.create(:page_part)
page.parts << FactoryBot.create(:page_part)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions pages/spec/helpers/refinery/pages/admin/pages_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Admin
describe "#template_options" do
context "when page layout/view template is set" do
it "returns those templates as selected" do
page = FactoryGirl.create(:page)
page = FactoryBot.create(:page)

page.view_template = "rspec_template"
expect(helper.template_options(:view_template, page)).to eq(:selected => "rspec_template")
Expand All @@ -22,7 +22,7 @@ module Admin
end

it "works as expected" do
page = FactoryGirl.create(:page, :layout_template => "three")
page = FactoryBot.create(:page, :layout_template => "three")

expect(helper.template_options(:layout_template, page)).to eq(:selected => 'three')
end
Expand All @@ -31,8 +31,8 @@ module Admin
context "when page layout template isn't set" do
context "when page has parent and parent has layout_template set" do
it "returns parent layout_template as selected" do
parent = FactoryGirl.create(:page, :layout_template => "rspec_layout")
page = FactoryGirl.create(:page, :parent_id => parent.id)
parent = FactoryBot.create(:page, :layout_template => "rspec_layout")
page = FactoryBot.create(:page, :parent_id => parent.id)

expected_layout = { :selected => parent.layout_template }
expect(helper.template_options(:layout_template, page)).to eq(expected_layout)
Expand All @@ -41,7 +41,7 @@ module Admin

context "when page doesn't have parent page" do
it "returns default application template" do
page = FactoryGirl.create(:page)
page = FactoryBot.create(:page)

expected_layout = { :selected => "application" }
expect(helper.template_options(:layout_template, page)).to eq(expected_layout)
Expand All @@ -51,7 +51,7 @@ module Admin
end

describe "#page_meta_information" do
let(:page) { FactoryGirl.build(:page) }
let(:page) { FactoryBot.build(:page) }

context "when show_in_menu is false" do
it "adds 'hidden' label" do
Expand Down
2 changes: 1 addition & 1 deletion pages/spec/models/refinery/page_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module Refinery
end

describe ".find_by_path_or_id" do
let!(:market) { FactoryGirl.create(:page, :title => "market") }
let!(:market) { FactoryBot.create(:page, :title => "market") }
let(:path) { "market" }
let(:id) { market.id }

Expand Down
2 changes: 1 addition & 1 deletion pages/spec/models/refinery/page_url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def turn_off_custom_slugs

context "given a page with a custom_slug exists" do
before do
FactoryGirl.create(:page, :custom_slug => custom_page_slug)
FactoryBot.create(:page, :custom_slug => custom_page_slug)
end

it "fails validation when a new record uses that custom_slug" do
Expand Down
8 changes: 4 additions & 4 deletions pages/spec/presenters/refinery/pages/menu_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ module Pages

describe "#to_html" do
let(:menu_items) {
Refinery::Menu.new(FactoryGirl.create(:page, :title => "Refinery CMS"))
Refinery::Menu.new(FactoryBot.create(:page, :title => "Refinery CMS"))
}
let(:menu_presenter) { MenuPresenter.new(menu_items, view) }

context "wrapped in html" do
it "returns menu items" do
expect(menu_presenter.to_html).to xml_eq(
Expand All @@ -72,7 +72,7 @@ module Pages
end

context "with role set to navigation" do
let(:menu_presenter_with_role) {
let(:menu_presenter_with_role) {
menu_presenter.menu_role = 'navigation'
menu_presenter
}
Expand All @@ -96,7 +96,7 @@ module Pages

context "when page has a link_url" do
let(:menu_items) {
Menu.new(FactoryGirl.create(:page, title: "Home", link_url: "/"))
Menu.new(FactoryBot.create(:page, title: "Home", link_url: "/"))
}
it "the menu item URL includes the mounted path" do
expect(menu_presenter.to_html).to xml_eq(
Expand Down
2 changes: 1 addition & 1 deletion resources/spec/factories/resource.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :resource, :class => Refinery::Resource do
file Refinery.roots('refinery/resources').join("spec/fixtures/refinery_is_awesome.txt")
end
Expand Down
6 changes: 3 additions & 3 deletions resources/spec/features/refinery/admin/resources_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module Admin
end

context "edit/update" do
let!(:resource) { FactoryGirl.create(:resource) }
let!(:resource) { FactoryBot.create(:resource) }

it "updates file" do
visit refinery.admin_resources_path
Expand Down Expand Up @@ -119,7 +119,7 @@ module Admin
end

context "destroy" do
let!(:resource) { FactoryGirl.create(:resource) }
let!(:resource) { FactoryBot.create(:resource) }

it "removes file" do
visit refinery.admin_resources_path
Expand All @@ -133,7 +133,7 @@ module Admin
end

context "download" do
let!(:resource) { FactoryGirl.create(:resource) }
let!(:resource) { FactoryBot.create(:resource) }

it "succeeds" do
visit refinery.admin_resources_path
Expand Down
4 changes: 2 additions & 2 deletions resources/spec/models/refinery/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module Refinery
describe Resource, :type => :model do
let(:resource) { FactoryGirl.create(:resource) }
let(:titled_resource) { FactoryGirl.create(:resource, resource_title: 'Resource Title')}
let(:resource) { FactoryBot.create(:resource) }
let(:titled_resource) { FactoryBot.create(:resource, resource_title: 'Resource Title')}

context "with valid attributes" do
it "should create successfully" do
Expand Down
6 changes: 3 additions & 3 deletions testing/lib/refinery/testing.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'refinerycms-core'
require 'rspec-rails'
require 'factory_girl'
require 'factory_bot'
require 'rails-controller-testing'

module Refinery
Expand All @@ -17,11 +17,11 @@ def load_factories
Refinery.extensions.each do |extension_const|
if extension_const.respond_to?(:factory_paths)
extension_const.send(:factory_paths).each do |path|
FactoryGirl.definition_file_paths << path
FactoryBot.definition_file_paths << path
end
end
end
FactoryGirl.find_definitions
FactoryBot.find_definitions
end
end

Expand Down
2 changes: 1 addition & 1 deletion testing/refinerycms-testing.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|

s.add_dependency 'refinerycms-core', version
s.add_dependency 'database_cleaner', '~> 1.6'
s.add_dependency 'factory_girl_rails', '~> 4.6'
s.add_dependency 'factory_bot_rails', '~> 4.8'
s.add_dependency 'rspec-rails', '~> 3.5'
s.add_dependency 'capybara', '~> 2.7'
s.add_dependency 'rails-controller-testing', '~> 0.1.1'
Expand Down

0 comments on commit 8665525

Please sign in to comment.