aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorZog2018-04-03 21:53:42 +0200
committerJohan Van Ryseghem2018-04-04 11:10:39 +0200
commite709a1ddaf5686b3463d7697cd21cee3d15957f2 (patch)
treec0f2f57124dae9b0e77dc49162d5dac1f832d3a3 /spec
parenta59aa62be66340bb1ac22bad7cb980dbf1a5ffa1 (diff)
downloadchouette-core-e709a1ddaf5686b3463d7697cd21cee3d15957f2.tar.bz2
Fix specs
Diffstat (limited to 'spec')
-rw-r--r--spec/models/custom_field_spec.rb2
-rw-r--r--spec/views/stop_areas/edit.html.erb_spec.rb1
-rw-r--r--spec/views/stop_areas/new.html.erb_spec.rb1
3 files changed, 4 insertions, 0 deletions
diff --git a/spec/models/custom_field_spec.rb b/spec/models/custom_field_spec.rb
index 3a432e7b3..1dfe6d33c 100644
--- a/spec/models/custom_field_spec.rb
+++ b/spec/models/custom_field_spec.rb
@@ -1,6 +1,7 @@
require 'rails_helper'
RSpec.describe CustomField, type: :model do
+
let( :vj ){ create :vehicle_journey, custom_field_values: {energy: 99} }
context "validates" do
@@ -46,6 +47,7 @@ RSpec.describe CustomField, type: :model do
let!(:field){ [create(:custom_field, code: :energy, field_type: 'list', options: {list_values: %w(foo bar baz)})] }
let!( :vj ){ create :vehicle_journey, custom_field_values: {energy: "1"} }
it "should cast the value" do
+ p vj.custom_fields
expect(vj.custom_fields[:energy].value).to eq 1
expect(vj.custom_fields[:energy].display_value).to eq "bar"
end
diff --git a/spec/views/stop_areas/edit.html.erb_spec.rb b/spec/views/stop_areas/edit.html.erb_spec.rb
index bfbb0bb55..1bdb42817 100644
--- a/spec/views/stop_areas/edit.html.erb_spec.rb
+++ b/spec/views/stop_areas/edit.html.erb_spec.rb
@@ -8,6 +8,7 @@ describe "/stop_areas/edit", :type => :view do
before do
allow(view).to receive(:has_feature?)
+ allow(view).to receive(:resource){ stop_area }
end
describe "form" do
diff --git a/spec/views/stop_areas/new.html.erb_spec.rb b/spec/views/stop_areas/new.html.erb_spec.rb
index 23f7387fa..eced129e4 100644
--- a/spec/views/stop_areas/new.html.erb_spec.rb
+++ b/spec/views/stop_areas/new.html.erb_spec.rb
@@ -7,6 +7,7 @@ describe "/stop_areas/new", :type => :view do
before do
allow(view).to receive(:has_feature?)
+ allow(view).to receive(:resource){ stop_area }
end
describe "form" do