2011-10-08 17:36:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Issues" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2011-10-08 17:36:38 -04:00
|
|
|
login_as :user
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /keys" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2011-10-08 17:36:38 -04:00
|
|
|
@key = Factory :key, :user => @user
|
|
|
|
visit keys_path
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { page }
|
|
|
|
|
|
|
|
it { should have_content(@key.title) }
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
describe "Destroy" do
|
|
|
|
it "should remove entry" do
|
2011-10-08 17:36:38 -04:00
|
|
|
expect {
|
|
|
|
click_link "destroy_key_#{@key.id}"
|
|
|
|
}.to change { @user.keys.count }.by(-1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
describe "New key", :js => true do
|
|
|
|
before do
|
2011-10-08 17:36:38 -04:00
|
|
|
visit keys_path
|
|
|
|
click_link "Add new"
|
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
it "should open new key popup" do
|
2011-10-08 17:36:38 -04:00
|
|
|
page.should have_content("Add new public key")
|
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
describe "fill in" do
|
2011-10-08 17:36:38 -04:00
|
|
|
before do
|
|
|
|
fill_in "key_title", :with => "laptop"
|
|
|
|
fill_in "key_key", :with => "publickey234="
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect { click_button "Save" }.to change {Key.count}.by(1) }
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
it "should add new key to table" do
|
2011-10-08 17:36:38 -04:00
|
|
|
click_button "Save"
|
|
|
|
|
|
|
|
page.should_not have_content("Add new public key")
|
|
|
|
page.should have_content "laptop"
|
|
|
|
page.should have_content "publickey234="
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|