aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
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