added RSpec and Shoulda. Tested User

This commit is contained in:
Marin Usalj
2012-11-24 14:20:22 -08:00
parent ab73a50550
commit 1effbf460d
9 changed files with 108 additions and 1349 deletions

2
.gitignore vendored
View File

@@ -17,3 +17,5 @@
config/settings.local.yml
config/settings/*.local.yml
config/environments/*.local.yml
*.sublime-workspace

3
.rspec Normal file
View File

@@ -0,0 +1,3 @@
-fp
--color
--require spec_helper

View File

@@ -20,6 +20,11 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
end
group :development, :test do
gem 'rspec-rails', '~> 2.0'
gem 'shoulda'
end
# jQuery
gem 'jquery-rails'

View File

@@ -42,6 +42,7 @@ GEM
execjs
coffee-script-source (1.3.3)
daemons (1.1.9)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
@@ -92,11 +93,28 @@ GEM
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec-core (2.12.0)
rspec-expectations (2.12.0)
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)
sass (3.2.1)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
shoulda (3.3.2)
shoulda-context (~> 1.0.1)
shoulda-matchers (~> 1.4.1)
shoulda-context (1.0.1)
shoulda-matchers (1.4.1)
activesupport (>= 3.0.0)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
@@ -128,7 +146,9 @@ DEPENDENCIES
pg
rails (= 3.2.8)
rails_config
rspec-rails (~> 2.0)
sass-rails (~> 3.2.3)
shoulda
sqlite3
therubyracer
thin

File diff suppressed because it is too large Load Diff

27
spec/fixtures/orders.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
token: MyString
transaction_id: MyString
address_one: MyString
address_two: MyString
city: MyString
state: MyString
zip: MyString
country: MyString
status: MyString
number: MyString
uuid: MyString
two:
token: MyString
transaction_id: MyString
address_one: MyString
address_two: MyString
city: MyString
state: MyString
zip: MyString
country: MyString
status: MyString
number: MyString
uuid: MyString

7
spec/fixtures/users.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
email: MyString
two:
email: MyString

6
spec/models/user_spec.rb Normal file
View File

@@ -0,0 +1,6 @@
describe User do
it { should have_many :orders }
it { should respond_to :email }
end

38
spec/spec_helper.rb Normal file
View File

@@ -0,0 +1,38 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end