diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/referential_spec.rb | 17 | ||||
| -rw-r--r-- | spec/views/organisations/show.html.erb | 17 | ||||
| -rw-r--r-- | spec/views/rule_parameter_sets/index.html.erb_spec.rb | 23 |
3 files changed, 31 insertions, 26 deletions
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb index 4c9338aa6..2086f66d5 100644 --- a/spec/models/referential_spec.rb +++ b/spec/models/referential_spec.rb @@ -12,10 +12,21 @@ describe Referential, :type => :model do it { should belong_to(:workbench) } context "Cloning referential" do - let(:cloned) { Referential.new_from(ref).tap(&:save!) } + let(:clone) do + Referential.new_from(ref) + end + + let(:saved_clone) do + clone.tap do |clone| + clone.metadatas.each do |metadata| + metadata.periodes = metadata.periodes.map { |period| Range.new(period.end+1, period.end+10) } + end + clone.save! + end + end it 'should create a ReferentialCloning' do - expect { cloned }.to change{ReferentialCloning.count}.by(1) + expect { saved_clone }.to change{ReferentialCloning.count}.by(1) end def metadatas_attributes(referential) @@ -23,7 +34,7 @@ describe Referential, :type => :model do end it 'should clone referential_metadatas' do - expect(metadatas_attributes(cloned)).to eq(metadatas_attributes(ref)) + expect(metadatas_attributes(clone)).to eq(metadatas_attributes(ref)) end end diff --git a/spec/views/organisations/show.html.erb b/spec/views/organisations/show.html.erb new file mode 100644 index 000000000..69f5e2956 --- /dev/null +++ b/spec/views/organisations/show.html.erb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "/organisations/show" do + + assign_organisation + + let(:organisation) { first_organisation } + let!(:user) { create :user, organisation: first_organisation } + + it "should render each User" do + render + organisation.users.each do |user| + rendered.should have_selector("div.user span.name", :text => user.name) + end + end + +end diff --git a/spec/views/rule_parameter_sets/index.html.erb_spec.rb b/spec/views/rule_parameter_sets/index.html.erb_spec.rb deleted file mode 100644 index c745e516f..000000000 --- a/spec/views/rule_parameter_sets/index.html.erb_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' - -describe "/organisations/show" do - - assign_organisation - - let!(:organisation) { create(:organisation) } - let!(:rule_parameter_sets) { assign :rule_parameter_sets, [ create(:rule_parameter_set, :organisation => organisation), - create(:rule_parameter_set, :organisation => organisation)] } - it "should render a show link for each rule_parameter_set" do - render - rule_parameter_sets.each do |rule_parameter_set| - #rendered.should have_selector(".rule_parameter_sets a[href='#{view.organisation_rule_parameter_set_path( rule_parameter_set)}']", :text => rule_parameter_set.name) - end - end - - it "should render a link to create a new rule_parameter_set" do - render - view.content_for(:sidebar).should have_selector(".actions a[href='#{new_organisation_rule_parameter_set_path}']") - end - -end - |
