diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-01-13 16:47:29 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-01-13 16:47:29 +0100 |
commit | 6c5aaabe8bb0ae1b8025953f6a9c462846bbb873 (patch) | |
tree | 93f68b2d3307b8f64187444a769a92cebf135caa /vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb | |
parent | 97130af8dd3f761bbc4cc085def3cd39b80b876e (diff) | |
parent | 00e2586a42931567d2ac18350d41dd882e7fcd92 (diff) | |
download | hmnoweb-6c5aaabe8bb0ae1b8025953f6a9c462846bbb873.tar.gz hmnoweb-6c5aaabe8bb0ae1b8025953f6a9c462846bbb873.tar.bz2 hmnoweb-6c5aaabe8bb0ae1b8025953f6a9c462846bbb873.zip |
Merge branch 'gallery-links'
Diffstat (limited to 'vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb')
-rw-r--r-- | vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb b/vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb new file mode 100644 index 0000000..f49e600 --- /dev/null +++ b/vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb @@ -0,0 +1,101 @@ +# encoding: utf-8 +require "spec_helper" + +describe Refinery do + describe "GalleryLinks" do + describe "Admin" do + describe "gallery_links" do + refinery_login_with :refinery_user + + describe "gallery_links list" do + before do + FactoryGirl.create(:gallery_link, :title => "UniqueTitleOne") + FactoryGirl.create(:gallery_link, :title => "UniqueTitleTwo") + end + + it "shows two items" do + visit refinery.gallery_links_admin_gallery_links_path + page.should have_content("UniqueTitleOne") + page.should have_content("UniqueTitleTwo") + end + end + + describe "create" do + before do + visit refinery.gallery_links_admin_gallery_links_path + + click_link "Add New Gallery Link" + end + + context "valid data" do + it "should succeed" do + fill_in "Title", :with => "This is a test of the first string field" + click_button "Save" + + page.should have_content("'This is a test of the first string field' was successfully added.") + Refinery::GalleryLinks::GalleryLink.count.should == 1 + end + end + + context "invalid data" do + it "should fail" do + click_button "Save" + + page.should have_content("Title can't be blank") + Refinery::GalleryLinks::GalleryLink.count.should == 0 + end + end + + context "duplicate" do + before { FactoryGirl.create(:gallery_link, :title => "UniqueTitle") } + + it "should fail" do + visit refinery.gallery_links_admin_gallery_links_path + + click_link "Add New Gallery Link" + + fill_in "Title", :with => "UniqueTitle" + click_button "Save" + + page.should have_content("There were problems") + Refinery::GalleryLinks::GalleryLink.count.should == 1 + end + end + + end + + describe "edit" do + before { FactoryGirl.create(:gallery_link, :title => "A title") } + + it "should succeed" do + visit refinery.gallery_links_admin_gallery_links_path + + within ".actions" do + click_link "Edit this gallery link" + end + + fill_in "Title", :with => "A different title" + click_button "Save" + + page.should have_content("'A different title' was successfully updated.") + page.should have_no_content("A title") + end + end + + describe "destroy" do + before { FactoryGirl.create(:gallery_link, :title => "UniqueTitleOne") } + + it "should succeed" do + visit refinery.gallery_links_admin_gallery_links_path + + click_link "Remove this gallery link forever" + + page.should have_content("'UniqueTitleOne' was successfully removed.") + Refinery::GalleryLinks::GalleryLink.count.should == 0 + end + end + + end + end + end +end |