Sha256: d0d74c7cd85e77c63988db1781fbfd8f78fb9713be27726d0a912dca47fc8b38
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' require 'test_components' require 'rspec-steps' RSpec::Steps.steps "access like a hash", js: true do before(:step) do # spec_helper resets the policy system after each test so we have to setup # before each test stub_const 'TestApplication', Class.new stub_const 'TestApplicationPolicy', Class.new TestApplicationPolicy.class_eval do always_allow_connection regulate_all_broadcasts { |policy| policy.send_all } allow_change(to: :all, on: [:create, :update, :destroy]) { true } end size_window(:small, :portrait) FactoryGirl.create(:user, first_name: 'Lily', last_name: 'DaDog') end it "can access attributes using the [] operator" do expect_promise do HyperMesh.load do User.find_by_first_name('Lily') end.then do |lily| lily[:first_name] end end.to eq('Lily') end it "can update attributes using the []= operator" do expect_promise do HyperMesh.load do User.find_by_first_name('Lily') end.then do |lily| lily[:last_name] = 'DerDog' lily.save end end.to be_truthy expect(User.find_by_first_name('Lily')[:last_name]).to eq('DerDog') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hyper-mesh-0.6.0 | spec/batch1/misc/access_like_hash_spec.rb |
hyper-mesh-0.5.4 | spec/batch1/misc/access_like_hash_spec.rb |