Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 33dbf68546
...
compare: d4929b2dee
  • 2 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 28, 2012
@bumi bumi added basic models and relations a9716ff
@bumi bumi Merge branch 'master' of github.com:sebastiandeutsch/digital-media-map
* 'master' of github.com:sebastiandeutsch/digital-media-map:
  about seite
  Factored GoogleMaps into a class
d4929b2
View
1  Gemfile
@@ -49,6 +49,7 @@ group :test do
gem "mocha", "~> 0.10"
gem "factory_girl_rails", "~> 1.7", require: false
gem "database_cleaner", "~> 0.7"
+ gem 'mongoid-rspec'
end
group :development, :test do
View
4 Gemfile.lock
@@ -134,6 +134,9 @@ GEM
activemodel (~> 3.1)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
+ mongoid-rspec (1.4.4)
+ mongoid (~> 2.0)
+ rspec (~> 2)
multi_json (1.3.2)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
@@ -254,6 +257,7 @@ DEPENDENCIES
mini_magick
mocha (~> 0.10)
mongoid
+ mongoid-rspec
rabl
rails (= 3.2.3)
rspec-rails (~> 2.8)
View
11 app/models/category.rb
@@ -0,0 +1,11 @@
+class Category
+ include Mongoid::Document
+
+ has_many :companies
+ has_many :tags
+
+ field :name, type: String
+
+ validates :name, presence: true
+
+end
View
4 app/models/company.rb
@@ -2,6 +2,10 @@ class Company
include Mongoid::Document
include Mongoid::Timestamps
+
+ belongs_to :category
+ has_many :tags
+
field :name, :type => String
field :description, :type => String
field :street, :type => String
View
10 app/models/tag.rb
@@ -0,0 +1,10 @@
+class Tag
+ include Mongoid::Document
+
+ has_many :companies
+
+ field :name, type: String
+
+ validates :name, presence: true
+
+end
View
9 spec/models/category_spec.rb
@@ -0,0 +1,9 @@
+require 'spec_helper'
+
+describe Category do
+
+ it { should have_many(:companies) }
+ it { should have_many(:tags) }
+ it { should validate_presence_of(:name) }
+
+end
View
8 spec/models/company_spec.rb
@@ -0,0 +1,8 @@
+require 'spec_helper'
+
+describe Company do
+
+ it { should belong_to :category }
+ it { should have_many :tags }
+
+end
View
7 spec/models/tag_spec.rb
@@ -0,0 +1,7 @@
+require 'spec_helper'
+
+describe Tag do
+
+ it { should have_many(:companies) }
+
+end
View
3  spec/spec_helper.rb
@@ -7,7 +7,8 @@
RSpec.configure do |config|
config.mock_with :mocha
config.extend VCR::RSpec::Macros
-
+ config.include Mongoid::Matchers
+
config.before :suite do
#DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)

No commit comments for this range

Something went wrong with that request. Please try again.