aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/refinery/blog/admin/categories_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/refinery/blog/admin/categories_spec.rb')
-rw-r--r--spec/features/refinery/blog/admin/categories_spec.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/features/refinery/blog/admin/categories_spec.rb b/spec/features/refinery/blog/admin/categories_spec.rb
index 507f417..7a8df8c 100644
--- a/spec/features/refinery/blog/admin/categories_spec.rb
+++ b/spec/features/refinery/blog/admin/categories_spec.rb
@@ -16,12 +16,12 @@ describe "Categories admin", type: :feature do
click_button "Save"
category = Refinery::Blog::Category.first
- category.title.should eq(title)
+ expect(category.title).to eq(title)
end
context "with translations" do
before do
- Refinery::I18n.stub(:frontend_locales).and_return([:en, :ru])
+ allow(Refinery::I18n).to receive(:frontend_locales).and_return([:en, :ru])
blog_page = Globalize.with_locale(:en) { FactoryGirl.create(:page, :link_url => "/blog", :title => "Blog") }
Globalize.with_locale(:ru) do
blog_page.title = 'блог'
@@ -35,32 +35,32 @@ describe "Categories admin", type: :feature do
visit refinery.blog_admin_posts_path
click_link "Create new category"
fill_in "Title", :with => "Testing Category"
- click_button "Save"
- @c = Refinery::Blog::Category.find_by_title("Testing Category")
+ expect { click_button "Save" }.to change(Refinery::Blog::Category, :count).by(1)
+ @c = Refinery::Blog::Category.by_title("Testing Category")
end
it "suceeds" do
- page.should have_content("'#{@c.title}' was successfully added.")
- Refinery::Blog::Category.count.should eq(1)
+ expect(page).to have_content("'#{@c.title}' was successfully added.")
+ expect(Refinery::Blog::Category.count).to eq(1)
end
- it "shows locale flag for category" do
+ it "shows locale for category" do
click_link "Manage"
within "#category_#{@c.id}" do
- page.should have_css("img[src='/assets/refinery/icons/flags/en.png']")
+ expect(page).to have_css(".locale_icon.en")
end
end
it "shows up in blog page for default locale" do
visit refinery.blog_root_path
within "#categories" do
- page.should have_selector('li')
+ expect(page).to have_selector('li')
end
end
it "does not show up in blog page for secondary locale" do
visit refinery.blog_root_path(:locale => :ru)
- page.should_not have_selector('#categories')
+ expect(page).not_to have_selector('#categories')
end
end
@@ -73,41 +73,41 @@ describe "Categories admin", type: :feature do
visit refinery.blog_admin_posts_path
click_link "Create new category"
within "#switch_locale_picker" do
- click_link "ru"
+ click_link "RU"
end
fill_in "Title", :with => ru_category_title
- click_button "Save"
- @c = Refinery::Blog::Category.find_by_title(ru_category_title)
+ expect { click_button "Save" }.to change(Refinery::Blog::Category, :count).by(1)
+ @c = Refinery::Blog::Category.by_title(ru_category_title)
end
it "suceeds" do
- page.should have_content("'#{@c.title}' was successfully added.")
- Refinery::Blog::Category.count.should eq(1)
+ expect(page).to have_content("'#{@c.title}' was successfully added.")
+ expect(Refinery::Blog::Category.count).to eq(1)
end
- it "shows locale flag for category" do
+ it "shows locale for category" do
click_link "Manage"
within "#category_#{@c.id}" do
- page.should have_css("img[src='/assets/refinery/icons/flags/ru.png']")
+ expect(page).to have_css(".locale_icon.ru")
end
end
- it "does not show locale flag for primary locale" do
+ it "does not show locale for primary locale" do
click_link "Manage"
within "#category_#{@c.id}" do
- page.should_not have_css("img[src='/assets/refinery/icons/flags/en.png']")
+ expect(page).not_to have_css(".locale_icon.en")
end
end
it "does not shows up in blog page for default locale" do
visit refinery.blog_root_path
- page.should_not have_selector('#categories')
+ expect(page).not_to have_selector('#categories')
end
it "shows up in blog page for secondary locale" do
visit refinery.blog_root_path(:locale => :ru)
within "#categories" do
- page.should have_selector('li')
+ expect(page).to have_selector('li')
end
end