Skip to content

Commit

Permalink
Trying to start writing tests with minitest
Browse files Browse the repository at this point in the history
  • Loading branch information
multiscan committed Jun 27, 2013
1 parent 3a89c68 commit 3e6626a
Show file tree
Hide file tree
Showing 15 changed files with 180 additions and 142 deletions.
22 changes: 13 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'

# -------------------------------------------------------------- BASE RAILS GEMS
gem 'rails', '3.2.9'
gem 'rack', '1.4.1' # https://makandracards.com/makandra/13580-fix-warning-no-secret-option-provided-to-rack-session-cookie
gem 'jquery-rails'
gem 'sqlite3'
gem 'mysql2'
Expand Down Expand Up @@ -63,17 +64,20 @@ group :development do
gem "binding_of_caller", ">= 0.6.8"
end

group :development, :test do
gem "rspec-rails", ">= 2.11.4", :group => [:development, :test]
gem "factory_girl_rails", ">= 4.1.0", :require => false
end
# group :development, :test do
# gem "rspec-rails", ">= 2.11.4", :group => [:development, :test]
# gem "factory_girl_rails", ">= 4.1.0", :require => false
# gem "cucumber-rails", ">= 1.3.0", :require => false
# gem "database_cleaner", ">= 0.9.1"
# gem "email_spec", ">= 1.4.0"
# gem "launchy", ">= 2.1.2"
# gem "capybara", ">= 2.0.1"
# end

group :test do
gem "cucumber-rails", ">= 1.3.0", :require => false
gem "database_cleaner", ">= 0.9.1"
gem "email_spec", ">= 1.4.0"
gem "launchy", ">= 2.1.2"
gem "capybara", ">= 2.0.1"
gem 'minitest'
gem 'capybara'
# gem 'turn'
end

# For searching book infos on the web https://github.com/jayfajardo/openlibrary
Expand Down
69 changes: 16 additions & 53 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,7 @@ GEM
execjs
coffee-script-source (1.4.0)
columnize (0.3.6)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
cucumber-rails (1.3.0)
capybara (>= 1.1.2)
cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
daemons (1.1.9)
database_cleaner (0.9.1)
debugger (1.6.0)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
Expand All @@ -94,24 +84,13 @@ GEM
orm_adapter (~> 0.1)
railties (~> 3.1)
warden (~> 1.2.1)
diff-lcs (1.1.3)
email_spec (1.4.0)
launchy (~> 2.1)
mail (~> 2.2)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.1.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.1.0)
factory_girl (~> 4.1.0)
railties (>= 3.0.0)
ffi (1.2.0)
figaro (0.5.0)
rails (~> 3.0)
gherkin (2.11.5)
json (>= 1.4.6)
gon (4.1.1)
actionpack (>= 2.3.0)
json
Expand All @@ -123,15 +102,13 @@ GEM
railties (>= 3.1, < 4.1)
hashery (2.1.0)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.1)
hike (1.2.3)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (2.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.5)
launchy (2.1.2)
addressable (~> 2.3)
json (1.8.0)
libwebsocket (0.1.7.1)
addressable
websocket
Expand All @@ -140,8 +117,9 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
memoist (0.2.0)
mime-types (1.19)
multi_json (1.5.0)
mime-types (1.23)
minitest (5.0.5)
multi_json (1.7.7)
mysql (2.9.0)
mysql2 (0.3.11)
net-scp (1.0.4)
Expand Down Expand Up @@ -173,7 +151,7 @@ GEM
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
Expand All @@ -194,22 +172,11 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12)
rake (10.1.0)
rdoc (3.12.2)
json (~> 1.4)
riddle (1.5.4)
rolify (3.2.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.0)
rspec-rails (2.12.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
ruby-rc4 (0.1.5)
rubyzip (0.9.9)
rvm-capistrano (1.2.7)
Expand Down Expand Up @@ -241,15 +208,15 @@ GEM
activerecord (>= 3.0.3)
builder (>= 2.1.2)
riddle (>= 1.5.0)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.14)
polyglot
polyglot (>= 0.3.1)
ttfunk (1.0.3)
turbolinks (1.1.1)
coffee-rails
tzinfo (0.3.35)
tzinfo (0.3.37)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
Expand All @@ -273,30 +240,26 @@ DEPENDENCIES
bootstrap-sass (>= 2.1.1.0)
cancan (>= 1.6.8)
capistrano
capybara (>= 2.0.1)
capybara
cheat
coffee-rails (~> 3.2.1)
cucumber-rails (>= 1.3.0)
database_cleaner (>= 0.9.1)
debugger
devise (>= 2.1.2)
email_spec (>= 1.4.0)
factory_girl_rails (>= 4.1.0)
figaro (>= 0.5.0)
gon
haml-rails
jquery-rails
launchy (>= 2.1.2)
memoist
minitest
mysql2
ox (~> 2.0.3)
prawn
prawn_rails
quiet_assets (>= 1.0.1)
rack (= 1.4.1)
rails (= 3.2.9)
rails3-jquery-autocomplete (= 1.0.9)
rolify (>= 3.2.0)
rspec-rails (>= 2.11.4)
rvm-capistrano
sass-rails (~> 3.2.3)
simple_form (>= 2.0.4)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/adm/locations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Adm::LocationsController < ApplicationController
class Adm::LocationsController < AdmController
# GET /adm/locations
# GET /adm/locations.json
def index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Feature: Sign in
In order to get access to protected sections of the site
A user
A admin
Should be able to sign in

Scenario: User is not signed up
Given I do not exist as a user
Scenario: Admin is not signed up
Given I do not exist as a admin
When I sign in with valid credentials
Then I see an invalid login message
And I should be signed out
And I should not see private navigation items

Scenario: User signs in successfully
Given I exist as a user
Scenario: Admin signs in successfully
Given I exist as a admin
And I am not logged in
When I sign in with valid credentials
Then I see a successful sign in message
Expand All @@ -31,15 +31,15 @@ Feature: Sign in
Then I should be signed in
And I should see navigation items for administrator

Scenario: User enters wrong email
Given I exist as a user
Scenario: Admin enters wrong email
Given I exist as a admin
And I am not logged in
When I sign in with a wrong email
Then I see an invalid login message
And I should be signed out

Scenario: User enters wrong password
Given I exist as a user
Scenario: Admin enters wrong password
Given I exist as a admin
And I am not logged in
When I sign in with a wrong password
Then I see an invalid login message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Feature: Sign out
To protect my account from unauthorized access
A signed in user
A signed in admin
Should be able to sign out

Scenario: User signs out
Scenario: Admin signs out
Given I am logged in
When I sign out
Then I should see a signed out message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
Feature: Sign up
In order to get access to protected sections of the site
As a user
As a admin
I want to be able to sign up

Background:
Given I am not logged in

Scenario: User signs up with valid data
When I sign up with valid user data
Scenario: Admin signs up with valid data
When I sign up with valid admin data
Then I should see a message with confirmation instruction

Scenario: User signs up with invalid email
Scenario: Admin signs up with invalid email
When I sign up with an invalid email
Then I should be asked to correct errors in the submitted data
And I should see an invalid email message

Scenario: User signs up without password
Scenario: Admin signs up without password
When I sign up without a password
Then I should be asked to correct errors in the submitted data
And I should see a missing password message

Scenario: User signs up without password confirmation
Scenario: Admin signs up without password confirmation
When I sign up without a password confirmation
Then I should be asked to correct errors in the submitted data
And I should see a missing password confirmation message

Scenario: User signs up with mismatched password and confirmation
Scenario: Admin signs up with mismatched password and confirmation
When I sign up with a mismatched password confirmation
Then I should be asked to correct errors in the submitted data
And I should see a mismatched password message
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Edit User
As a registered user of the website
I want to edit my user profile
so I can change my username
Feature: Edit Admin
As a registered admin of the website
I want to edit my admin profile
so I can change my admin name

Scenario: I sign in and edit my account
Given I am logged in
Expand Down
Loading

0 comments on commit 3e6626a

Please sign in to comment.