Permalink
Browse files

finished specs

  • Loading branch information...
1 parent ec03d69 commit be0e6fc03ba6f6fae7601829d64ba11356f00e4a @jokklan jokklan committed with simi Mar 30, 2013
Showing with 34 additions and 54 deletions.
  1. +1 −1 .gitignore
  2. +33 −53 spec/requests/refinery/admin/settings_spec.rb
View
@@ -1,3 +1,3 @@
.DS_Store
Gemfile.lock
-spec/dummy
+spec/dummy
@@ -5,82 +5,62 @@ module Admin
describe "Settings" do
refinery_login_with :refinery_user
- context "when interface config is enabled" do
- before do
- Refinery::Settings.stub(:enable_interface).and_return(true)
- end
- it "shows up in menu" do
- visit refinery.admin_root_path
-
- within('nav') do
- page.should have_content "Settings"
- end
- end
-
- context "when no settings" do
- before(:each) { Refinery::Setting.destroy_all }
+ context "when no settings" do
+ before(:each) { Refinery::Setting.destroy_all }
- it "invites to create one" do
- visit refinery.admin_settings_path
- page.should have_content("There are no settings yet. Click 'Add new setting' to add your first setting.")
- end
- end
-
- it "shows add new setting link" do
+ it "invites to create one" do
visit refinery.admin_settings_path
- page.should have_content("Add new setting")
- page.should have_selector("a[href*='/refinery/settings/new']")
+ page.should have_content("There are no settings yet. Click 'Add new setting' to add your first setting.")
end
+ end
- context "new/create" do
- it "adds setting", :js => true do
- visit refinery.admin_settings_path
- click_link "Add new setting"
+ it "shows add new setting link" do
+ visit refinery.admin_settings_path
+ page.should have_content("Add new setting")
+ page.should have_selector("a[href*='/refinery/settings/new']")
+ end
- page.should have_selector('iframe#dialog_iframe')
+ context "new/create" do
+ it "adds setting", :js => true do
+ visit refinery.admin_settings_path
+ click_link "Add new setting"
- page.within_frame('dialog_iframe') do
- fill_in "Name", :with => "test setting"
- fill_in "Value", :with => "true"
+ page.should have_selector('iframe#dialog_iframe')
- click_button "Save"
- end
+ page.within_frame('dialog_iframe') do
+ fill_in "Name", :with => "test setting"
+ fill_in "Value", :with => "true"
- page.should have_content("'Test Setting' was successfully added.")
- page.should have_content("Test Setting - true")
+ click_button "Save"
end
+
+ page.should have_content("'Test Setting' was successfully added.")
+ page.should have_content("Test Setting - true")
end
+ end
- context "pagination" do
- before(:each) do
- (Refinery::Setting.per_page + 1).times do
- FactoryGirl.create(:setting)
- end
+ context "pagination" do
+ before(:each) do
+ (Refinery::Setting.per_page + 1).times do
+ FactoryGirl.create(:setting)
end
+ end
- specify "page links" do
- visit refinery.admin_settings_path
+ specify "page links" do
+ visit refinery.admin_settings_path
- page.should have_selector("a[href*='settings?page=2']")
- end
+ page.should have_selector("a[href*='settings?page=2']")
end
end
context "when interface config is disabled" do
before do
Refinery::Settings.stub(:enable_interface).and_return(false)
end
-
- it "does not show up in menu" do
- visit refinery.admin_root_path
-
- within('nav') do
- page.should_not have_content "Settings"
- end
- end
it "should not be accessible" do
-
+ visit refinery.admin_settings_path
+ current_path.should == refinery.admin_root_path
end
end

0 comments on commit be0e6fc

Please sign in to comment.