aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/offer_workbenches_controller_spec.rb13
-rw-r--r--spec/factories/offer_workbenches.rb7
-rw-r--r--spec/helpers/offer_workbenches_helper_spec.rb15
-rw-r--r--spec/models/offer_workbench_spec.rb13
-rw-r--r--spec/models/organisation_spec.rb8
-rw-r--r--spec/rails_helper.rb50
-rw-r--r--spec/views/offer_workbenches/show.html.erb_spec.rb5
7 files changed, 109 insertions, 2 deletions
diff --git a/spec/controllers/offer_workbenches_controller_spec.rb b/spec/controllers/offer_workbenches_controller_spec.rb
new file mode 100644
index 000000000..f815b8492
--- /dev/null
+++ b/spec/controllers/offer_workbenches_controller_spec.rb
@@ -0,0 +1,13 @@
+require 'spec_helper'
+
+RSpec.describe OfferWorkbenchesController, :type => :controller do
+ let(:offerworkbench) { create :offer_workbench }
+
+ describe "GET show" do
+ it "returns http success" do
+ get :show, id: offerworkbench.id
+ expect(response).to have_http_status(302)
+ end
+ end
+
+end
diff --git a/spec/factories/offer_workbenches.rb b/spec/factories/offer_workbenches.rb
new file mode 100644
index 000000000..e9e5b2cd9
--- /dev/null
+++ b/spec/factories/offer_workbenches.rb
@@ -0,0 +1,7 @@
+FactoryGirl.define do
+ factory :offer_workbench do
+ sequence(:name) { |n| "Offer workbench #{n}" }
+
+ association :organisation, :factory => :organisation
+ end
+end
diff --git a/spec/helpers/offer_workbenches_helper_spec.rb b/spec/helpers/offer_workbenches_helper_spec.rb
new file mode 100644
index 000000000..d9fa86242
--- /dev/null
+++ b/spec/helpers/offer_workbenches_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the OfferWorkbenchesHelper. For example:
+#
+# describe OfferWorkbenchesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe OfferWorkbenchesHelper, :type => :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/offer_workbench_spec.rb b/spec/models/offer_workbench_spec.rb
new file mode 100644
index 000000000..6b29d3d82
--- /dev/null
+++ b/spec/models/offer_workbench_spec.rb
@@ -0,0 +1,13 @@
+require 'rails_helper'
+
+RSpec.describe OfferWorkbench, :type => :model do
+
+ it 'should have a valid factory' do
+ expect(FactoryGirl.build(:offer_workbench)).to be_valid
+ end
+
+ it { should validate_presence_of(:name) }
+ it { should validate_uniqueness_of(:name) }
+ it { should validate_presence_of(:organisation) }
+
+end
diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb
index 66b1e8534..fb9d3629b 100644
--- a/spec/models/organisation_spec.rb
+++ b/spec/models/organisation_spec.rb
@@ -2,8 +2,12 @@ require 'spec_helper'
describe Organisation do
- #it { should validate_presence_of(:name) }
- #it { should validate_uniqueness_of(:name) }
+ it { should validate_presence_of(:name) }
+ it { should validate_uniqueness_of(:name) }
+
+ it 'should have a valid factory' do
+ expect(FactoryGirl.build(:organisation)).to be_valid
+ end
it "create a rule_parameter_set" do
organisation = create(:organisation)
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
new file mode 100644
index 000000000..e6c0b688f
--- /dev/null
+++ b/spec/rails_helper.rb
@@ -0,0 +1,50 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+ENV["RAILS_ENV"] ||= 'test'
+require 'spec_helper'
+require File.expand_path("../../config/environment", __FILE__)
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+# Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
+
+# Checks for pending migrations before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.maintain_test_schema!
+
+RSpec.configure do |config|
+ # 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
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
+end
diff --git a/spec/views/offer_workbenches/show.html.erb_spec.rb b/spec/views/offer_workbenches/show.html.erb_spec.rb
new file mode 100644
index 000000000..884cf588c
--- /dev/null
+++ b/spec/views/offer_workbenches/show.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe "offer_workbenches/show.html.erb", :type => :view do
+
+end