mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 01:07:09 +02:00
Add feature spec
This commit is contained in:
parent
136d4da7b6
commit
fc044bd719
1
Gemfile
1
Gemfile
@ -10,4 +10,5 @@ group :development, :test do
|
||||
gem "rspec-rails", "~> 2.0"
|
||||
gem "factory_girl_rails"
|
||||
gem "database_cleaner", "~> 1.2.0"
|
||||
gem "capybara", "~> 2.2.1"
|
||||
end
|
||||
|
@ -47,6 +47,12 @@ GEM
|
||||
arel (5.0.1.20140414130214)
|
||||
bcrypt (3.1.7)
|
||||
builder (3.2.2)
|
||||
capybara (2.2.1)
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
xpath (~> 2.0)
|
||||
coderay (1.1.0)
|
||||
coffee-rails (4.0.1)
|
||||
coffee-script (>= 2.2.0)
|
||||
@ -188,12 +194,15 @@ GEM
|
||||
unf_ext
|
||||
unf_ext (0.0.6)
|
||||
webrobots (0.1.1)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
yajl-ruby (1.2.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
capybara (~> 2.2.1)
|
||||
database_cleaner (~> 1.2.0)
|
||||
factory_girl_rails
|
||||
fluentd-ui!
|
||||
|
@ -4,4 +4,5 @@
|
||||
= f.text_field :name
|
||||
= f.label :password
|
||||
= f.text_field :password
|
||||
= f.submit
|
||||
= submit_tag t("terms.sign_in")
|
||||
|
||||
|
31
spec/features/sign_in_spec.rb
Normal file
31
spec/features/sign_in_spec.rb
Normal file
@ -0,0 +1,31 @@
|
||||
describe "the sign in process" do
|
||||
let(:submit_label) { I18n.t("terms.sign_in") }
|
||||
let(:exists_user) { FactoryGirl.create(:user) }
|
||||
before do
|
||||
visit '/sessions/new'
|
||||
within("form") do
|
||||
fill_in 'session_name', :with => user.name
|
||||
fill_in 'session_password', :with => user.password
|
||||
end
|
||||
click_button submit_label
|
||||
end
|
||||
|
||||
context "sign in with exists user" do
|
||||
let(:user) { exists_user }
|
||||
it "login success, then redirect to root_path" do
|
||||
current_path.should == root_path
|
||||
end
|
||||
end
|
||||
|
||||
context "sign in with non-exists user" do
|
||||
let(:user) { FactoryGirl.build(:user) }
|
||||
|
||||
it "current location is not root_path" do
|
||||
current_path.should_not == root_path
|
||||
end
|
||||
|
||||
it "display form for retry" do
|
||||
page.body.should have_css('form')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user